Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2014-09-02 18:57:35 -05:00
commit 2d5c676e1b
60 changed files with 4571 additions and 319 deletions

View File

@ -11,8 +11,8 @@ public enum Rank
OWNER("Owner", ChatColor.DARK_RED),
DEVELOPER("Dev", ChatColor.RED),
ADMIN("Admin", ChatColor.RED),
SNR_MODERATOR("Sr.Mod", ChatColor.GRAY),
MODERATOR("Mod", ChatColor.GOLD),
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
MODERATOR("Mod", ChatColor.DARK_GREEN),
HELPER("Helper", ChatColor.GREEN),
MAPDEV("Mapper", ChatColor.BLUE),
YOUTUBE("YouTube", ChatColor.RED),

View File

@ -505,6 +505,10 @@ public class UtilEnt
if (player.getLocation().add(x, -0.5, z).getBlock().getType() != Material.AIR && !player.getLocation().add(x, -0.5, z).getBlock().isLiquid())
return true;
//Inside a Lillypad
if (player.getLocation().add(x, 0, z).getBlock().getType() == Material.WATER_LILY)
return true;
//Fences/Walls
Material beneath = player.getLocation().add(x, -1.5, z).getBlock().getType();
if (player.getLocation().getY() % 0.5 == 0 &&

View File

@ -23,7 +23,7 @@ public enum Achievement
BRIDGES_SNIPER("Sniper", 600,
new String[] {"The Bridges.Sniper"},
new String[] {"Kill an enemy with Bow before Bridges fall"},
new String[] {"Kill an enemy with Archery before Bridges fall"},
new int[] {1},
AchievementCategory.BRIDGES),

View File

@ -99,9 +99,9 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
else
{
if (gadget.GetCost(CurrencyType.Coins) > 0 && DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins))
AddButton(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new GadgetButton(gadget, this));
AddButton(slot, new ShopItem(Material.INK_SACK, (byte)8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new GadgetButton(gadget, this));
else
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}

View File

@ -3,6 +3,7 @@ package mineplex.core.cosmetic.ui.page;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
@ -51,7 +52,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
else
{
*/
AddItem(13, new ShopItem(Material.CHEST, C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)" + ChatColor.RESET, 1, false));
AddItem(13, new ShopItem(Material.CHEST, ChatColor.RESET + C.cGold + treasureChestCount + " Treasure Chests (COMING SOON!)" + ChatColor.RESET, 1, false));
//}
final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));
@ -115,7 +116,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle);
AddButton(36,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton()
{
@Override
@ -133,7 +134,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Item);
AddButton(38,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton()
{
@Override
@ -151,7 +152,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph);
AddButton(40,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton()
{
@Override
@ -169,7 +170,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Mount<?> mount = Plugin.getMountManager().getActive(Player);
AddButton(42,
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), C.mItem + mount.GetName(), new String[] {}, 1, false, false),
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), ChatColor.RESET + C.mItem + mount.GetName(), new String[] {}, 1, false, false),
new SingleButton()
{
@Override
@ -184,7 +185,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
if (Plugin.getPetManager().hasActivePet(Player.getName()))
{
AddButton(44, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
AddButton(44, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
new SingleButton()
{
@Override

View File

@ -71,9 +71,9 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
else
{
if (mount.GetCost(CurrencyType.Coins) != -1 && DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins))
AddButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Purchase " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new MountButton(mount, this));
AddButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new MountButton(mount, this));
else
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Purchase " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()

View File

@ -2,6 +2,7 @@ package mineplex.core.disguise;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@ -58,6 +59,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
private NautHashMap<String, DisguiseBase> _entityDisguiseMap = new NautHashMap<String, DisguiseBase>();
private NautHashMap<String, EntityType> _addTempList = new NautHashMap<String, EntityType>();
private HashSet<String> _delTempList = new HashSet<String>();
private NautHashMap<DisguiseBase, HashSet<Player>> _disguisePlayerMap = new NautHashMap<DisguiseBase, HashSet<Player>>();
private Field _attributesA;
private Field _soundB;
@ -105,12 +107,44 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
return _spawnPacketMap.get(entity.getEntityId());
}
public void disguise(DisguiseBase disguise)
public void addViewerToDisguise(DisguiseBase disguise, Player player)
{
_disguisePlayerMap.get(disguise).add(player);
reApplyDisguise(disguise, player);
}
public void removeViewerToDisguise(DisguiseBase disguise, Player player)
{
_disguisePlayerMap.get(disguise).remove(player);
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(disguise.GetEntity().getId()));
if (disguise.GetEntity() instanceof EntityPlayer)
{
player.hidePlayer(Bukkit.getPlayer(disguise.GetEntity().getName()));
player.showPlayer(Bukkit.getPlayer(disguise.GetEntity().getName()));
}
else
{
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSpawnEntityLiving((net.minecraft.server.v1_7_R4.EntityLiving)disguise.GetEntity()));
}
}
public void disguise(DisguiseBase disguise, Player...players)
{
if (!disguise.GetEntity().isAlive())
return;
if (players == null || players.length == 0)
{
players = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]);
}
_spawnPacketMap.put(disguise.GetEntityId(), disguise);
_disguisePlayerMap.put(disguise, new HashSet<Player>());
_disguisePlayerMap.get(disguise).addAll(Arrays.asList(players));
reApplyDisguise(disguise);
}
@ -120,11 +154,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
if (!_spawnPacketMap.containsKey(entity.getEntityId()))
return;
_spawnPacketMap.remove(entity.getEntityId());
DisguiseBase disguise = _spawnPacketMap.remove(entity.getEntityId());
_movePacketMap.remove(entity.getEntityId());
_moveTempMap.remove(entity.getEntityId());
for (Player player : Bukkit.getOnlinePlayers())
for (Player player : _disguisePlayerMap.get(disguise))
{
if (entity == player)
continue;
@ -146,14 +180,16 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
public void reApplyDisguise(final DisguiseBase disguise)
{
for (Player player : Bukkit.getOnlinePlayers())
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(disguise.GetEntityId());
for (Player player : _disguisePlayerMap.get(disguise))
{
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
continue;
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(disguise.GetEntityId()));
entityPlayer.playerConnection.sendPacket(destroyPacket);
}
List<Packet> tempArmor = new ArrayList<Packet>();
@ -173,7 +209,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
{
public void run()
{
for (Player player : Bukkit.getOnlinePlayers())
for (Player player : _disguisePlayerMap.get(disguise))
{
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
continue;
@ -189,10 +225,49 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
}
});
}
public void reApplyDisguise(final DisguiseBase disguise, final Player player)
{
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(disguise.GetEntityId());
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
return;
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(destroyPacket);
List<Packet> tempArmor = new ArrayList<Packet>();
if (disguise instanceof DisguiseInsentient && disguise.GetEntity() instanceof LivingEntity)
{
if (((DisguiseInsentient)disguise).armorVisible())
{
for (Packet armorPacket : ((DisguiseInsentient)disguise).getArmorPackets())
tempArmor.add(armorPacket);
}
}
final List<Packet> armorPackets = tempArmor;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
{
public void run()
{
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
entityPlayer.playerConnection.sendPacket(disguise.GetSpawnPacket());
for (Packet packet : armorPackets)
{
entityPlayer.playerConnection.sendPacket(packet);
}
}
});
}
public void updateDisguise(DisguiseBase disguise)
{
for (Player player : Bukkit.getOnlinePlayers())
for (Player player : _disguisePlayerMap.get(disguise))
{
if (disguise.GetEntity() == ((CraftPlayer)player).getHandle())
continue;
@ -265,6 +340,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
public void PlayerQuit(PlayerQuitEvent event)
{
undisguise(event.getPlayer());
for (DisguiseBase disguise : _disguisePlayerMap.keySet())
{
_disguisePlayerMap.get(disguise).remove(event.getPlayer());
}
}
@Override
@ -274,7 +354,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
{
int entityId = ((PacketPlayOutNamedEntitySpawn)packet).a;
if (_spawnPacketMap.containsKey(entityId))
if (_spawnPacketMap.containsKey(entityId) && _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))
{
packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket());
return false;
@ -284,7 +364,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
{
int entityId = ((PacketPlayOutSpawnEntity)packet).a;
if (_spawnPacketMap.containsKey(entityId))
if (_spawnPacketMap.containsKey(entityId) && _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))
{
packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket());
return false;
@ -307,7 +387,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
e.printStackTrace();
}
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId && _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner))
{
// Crash clients with meta to a block id.
if (_spawnPacketMap.get(entityId) instanceof DisguiseBlock)
@ -318,7 +398,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
{
int entityId = ((PacketPlayOutAnimation)packet).a;
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
if (containsSpawnDisguise(owner, entityId) && owner.getEntityId() != entityId)
{
return false;
}
@ -327,7 +407,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
{
int entityId = ((PacketPlayOutEntityMetadata)packet).a;
if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId)
if (containsSpawnDisguise(owner, entityId) && owner.getEntityId() != entityId)
{
packetList.forceProcess(_spawnPacketMap.get(entityId).GetMetaDataPacket());
return false;
@ -337,7 +417,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
{
int entityId = ((PacketPlayOutEntityEquipment)packet).a;
if (_spawnPacketMap.containsKey(entityId) && _spawnPacketMap.get(entityId) instanceof DisguiseInsentient)
if (containsSpawnDisguise(owner, entityId) && _spawnPacketMap.get(entityId) instanceof DisguiseInsentient)
{
if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((PacketPlayOutEntityEquipment)packet).b != 0)
{
@ -378,7 +458,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
_movePacketMap.remove(movePacket.a);
}
if (!_spawnPacketMap.containsKey(movePacket.a))
if (!containsSpawnDisguise(owner, movePacket.a))
return true;
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
@ -430,7 +510,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
_movePacketMap.remove(movePacket.a);
}
if (!_spawnPacketMap.containsKey(movePacket.a))
if (!containsSpawnDisguise(owner, movePacket.a))
return true;
final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity();
@ -463,6 +543,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
});
}
}
/*
else if (packet instanceof PacketPlayOutNamedSoundEffect)
{
try
@ -487,10 +568,16 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
e.printStackTrace();
}
}
*/
return true;
}
private boolean containsSpawnDisguise(Player owner, int entityId)
{
return _spawnPacketMap.containsKey(entityId) && (_disguisePlayerMap.containsKey(_spawnPacketMap.get(entityId)) && _disguisePlayerMap.get(_spawnPacketMap.get(entityId)).contains(owner));
}
public void PrepAddDisguise(Player caller, EntityType entityType)
{
_addTempList.put(caller.getName(), entityType);

View File

@ -8,6 +8,7 @@ import net.minecraft.util.com.mojang.authlib.GameProfile;
public class DisguisePlayer extends DisguiseHuman
{
private GameProfile _profile;
private boolean _sneaking;
public DisguisePlayer(org.bukkit.entity.Entity entity)
{
@ -26,6 +27,24 @@ public class DisguisePlayer extends DisguiseHuman
_profile = profile;
}
public void setSneaking(boolean sneaking)
{
_sneaking = sneaking;
}
@Override
public void UpdateDataWatcher()
{
super.UpdateDataWatcher();
byte b0 = DataWatcher.getByte(0);
if (_sneaking)
DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 1)));
else
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 1))));
}
@Override
public Packet GetSpawnPacket()
{

View File

@ -31,7 +31,6 @@ public class Donor
_transactions = token.Transactions;
_coinTransactions = token.CoinRewards;
if (_salesPackagesOwned == null)
{
_salesPackagesOwned = new ArrayList<Integer>();
@ -42,10 +41,15 @@ public class Donor
_unknownSalesPackagesOwned = new ArrayList<String>();
}
if (_unknownSalesPackagesOwned == null)
if (_transactions == null)
{
_transactions = new ArrayList<TransactionToken>();
}
if (_coinTransactions == null)
{
_coinTransactions = new ArrayList<CoinTransactionToken>();
}
}
public int GetGems()

View File

@ -62,6 +62,7 @@ public class MorphPumpkinKing extends MorphGadget
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
player.getInventory().setHelmet(null);
}

View File

@ -7,6 +7,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
@ -170,4 +171,11 @@ public class MountCart extends Mount<Minecart>
}
}
}
@EventHandler
public void cancelBreak(EntityDamageEvent event)
{
if (GetActive().values().contains(event.getEntity()))
event.setCancelled(true);
}
}

View File

@ -47,8 +47,9 @@ public class DDoSProtectionSwitcher
//while (true)
//{
if (_repository.switchToDDOSProt())
{
//if (_repository.switchToDDOSProt())
//{
/*
System.out.println("Starting DDoS Protection Switch at " + dateFormat.format(new Date()));
DomainRecords records = new ApiGetCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728,
@ -110,7 +111,7 @@ public class DDoSProtectionSwitcher
+ idBuilder.toString()).Execute();
System.out.println("Deleted " + recordsToDelete.size() + " records.");
}
*/
// Switching US Bungees
switchServer("10.35.74.130", "108.178.20.166", "108.163.222.202", "108.178.20.165", "108.163.222.201");
switchServer("10.35.74.132", "108.163.217.110", "108.178.44.50", "108.163.217.109", "108.178.44.49");
@ -133,6 +134,7 @@ public class DDoSProtectionSwitcher
switchServer("10.32.214.249", "107.6.158.78", "184.154.13.38", "107.6.158.77", "184.154.13.37");
switchServer("10.32.214.247", "184.154.13.118", "108.163.242.98", "184.154.13.117", "108.163.242.97");
/*
// Switching EU Bungees
switchServer("10.82.2.202", "107.6.176.194", "107.6.176.34", "107.6.176.193", "107.6.176.33");
switchServer("10.82.2.204", "107.6.176.122", "107.6.176.50", "107.6.176.121", "107.6.176.49");
@ -142,9 +144,9 @@ public class DDoSProtectionSwitcher
switchServer("10.82.2.227", "107.6.176.26", "107.6.176.46", "107.6.176.25", "107.6.176.45");
switchServer("10.82.2.228", "107.6.176.110", "107.6.176.70", "107.6.176.109", "107.6.176.69");
switchServer("10.82.2.226", "107.6.176.138", "107.6.176.234", "107.6.176.137", "107.6.176.233");
sendMail();
}
*/
//sendMail();
//}
int processWaits = 0;

View File

@ -10,7 +10,7 @@
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${build_files}${BUILD_FILES}/common.xml"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/common.xml"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Nautilus.Core.CraftBukkit}"/>

View File

@ -30,6 +30,7 @@ import mineplex.core.mount.MountManager;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager;
import mineplex.core.playerTracker.PlayerTracker;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
@ -117,7 +118,8 @@ public class Arcade extends JavaPlugin
//Arcade Manager
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, cosmeticManager, projectileManager, webServerAddress);
new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs());
new MemoryFix(this);
//Updates

View File

@ -647,8 +647,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
// Arrows go bye bye.
((CraftPlayer) player).getHandle().p(0);
GetCondition().EndCondition(player, ConditionType.CLOAK, null);
//Remove all conditions
GetCondition().EndCondition(player, null, null);
HubClock(player);
GetDisguise().undisguise(player);

View File

@ -26,7 +26,7 @@ import nautilus.game.arcade.game.games.halloween.Halloween;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.micro.Micro;
import nautilus.game.arcade.game.games.milkcow.MilkCow;
//import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.mineware.MineWare;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverTeams;
@ -79,7 +79,7 @@ public class GameFactory
else if (gameType == GameType.Halloween) return new Halloween(_manager);
else if (gameType == GameType.HideSeek) return new HideSeek(_manager);
else if (gameType == GameType.Micro) return new Micro(_manager);
//else if (gameType == GameType.MineStrike) return new MineStrike(_manager);
else if (gameType == GameType.MineStrike) return new MineStrike(_manager);
else if (gameType == GameType.MineWare) return new MineWare(_manager);
else if (gameType == GameType.MilkCow) return new MilkCow(_manager);
else if (gameType == GameType.Paintball) return new Paintball(_manager);

View File

@ -6,6 +6,7 @@ import mineplex.core.common.util.*;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -37,10 +38,14 @@ import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Hanging;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.scoreboard.Objective;
import org.bukkit.util.Vector;
@ -1147,4 +1152,25 @@ public abstract class Game implements Listener
{
return _statTrackers;
}
@EventHandler
public void onHangingBreak(HangingBreakEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void onHangingPlace(HangingPlaceEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void onDamageHanging(EntityDamageEvent event)
{
if (event.getEntity() instanceof Hanging)
{
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,322 @@
package nautilus.game.arcade.game.games.minestrike;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.equipment.DefusalKit;
import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Helmet;
import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Kevlar;
import nautilus.game.arcade.game.games.minestrike.items.grenades.*;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.pistol.*;
import nautilus.game.arcade.game.games.minestrike.items.guns.rifle.*;
import nautilus.game.arcade.game.games.minestrike.items.guns.shotgun.*;
import nautilus.game.arcade.game.games.minestrike.items.guns.smg.*;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
public class ShopManager
{
private MineStrike Host;
private HashMap<Player, HashMap<Integer, StrikeItem>> _shop = new HashMap<Player, HashMap<Integer, StrikeItem>>();
private HashMap<Player, Integer> _money = new HashMap<Player, Integer>();
private HashSet<Player> _inShop = new HashSet<Player>();
public ShopManager(MineStrike host)
{
Host = host;
}
public void enterShop(Player player)
{
GameTeam team = Host.GetTeam(player);
if (team == null)
return;
clearShopInventory(player);
_shop.put(player, new HashMap<Integer, StrikeItem>());
int slot;
//Pistols
slot = 9;
//addItem(team.GetColor() == ChatColor.RED ? new Glock18() : new USP(), player, slot++);
addItem(new CZ75(), player, slot++);
addItem(new Deagle(), player, slot++);
//Shotgun
slot = 18;
addItem(new Nova(), player, slot++);
//SMG
addItem(new P90(), player, slot++);
//Rifles
slot = 27;
addItem(team.GetColor() == ChatColor.RED ? new AK47() : new M4A1(), player, slot++);
addItem(new AWP(), player, slot++);
//Grenades
addItem(new FlashBang(), player, 15);
addItem(new HighExplosive(), player, 16);
addItem(new Smoke(), player, 17);
//Gear
if (team.GetColor() == ChatColor.AQUA)
addItem(new DefusalKit(), player, 26);
//Equipment
addItem(new Helmet(), player, 34);
addItem(new Kevlar(), player, 35);
_inShop.add(player);
}
public void addItem(StrikeItem item, Player player, int slot)
{
player.getInventory().setItem(slot, item.getShopItem(getMoney(player), hasItem(player, item)));
_shop.get(player).put(slot, item);
}
public boolean hasItem(Player player, StrikeItem item)
{
int count = 0;
for (int i=0 ; i<9 ; i++)
{
if (UtilGear.isMat(player.getInventory().getItem(i), item.getSkin()))
count++;
if (UtilGear.isMat(player.getInventory().getHelmet(), item.getSkin()))
count++;
if (UtilGear.isMat(player.getInventory().getChestplate(), item.getSkin()))
count++;
}
if (count > 0)
{
if (item.getType() == StrikeItemType.PRIMARY_WEAPON ||
item.getType() == StrikeItemType.SECONDARY_WEAPON ||
item.getType() == StrikeItemType.EQUIPMENT)
return true;
if (item instanceof Grenade)
{
Grenade grenade = (Grenade)item;
if (!grenade.canGiveToPlayer(player))
return true;
}
}
if (item instanceof Kevlar)
{
System.out.println("Checking Kevlar");
Kevlar armor = (Kevlar)item;
if (armor.isArmor(player.getInventory().getChestplate()))
{
System.out.println("Checking Kevlar TRUE");
return true;
}
}
if (item instanceof Helmet)
{
Helmet armor = (Helmet)item;
if (armor.isArmor(player.getInventory().getHelmet()))
return true;
}
return false;
}
public void clearShopInventory(Player player)
{
_shop.remove(player);
for (int i=9 ; i<36 ; i++)
player.getInventory().setItem(i, null);
}
public int getMoney(Player player)
{
if (!_money.containsKey(player))
_money.put(player, 800);
return _money.get(player);
}
public void addMoney(Player player, int amount, String reason)
{
_money.put(player, Math.min(16000, getMoney(player) + amount));
UtilPlayer.message(player, F.main("Game", "Received " + F.elem(C.cDGreen + "$" + amount) + " for " + reason + "."));
}
public void inventoryClick(InventoryClickEvent event)
{
event.setCancelled(true);
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
if (player == null)
return;
GameTeam team = Host.GetTeam(player);
if (team == null)
return;
if (!_shop.containsKey(player))
return;
if (!_shop.get(player).containsKey(event.getSlot()))
return;
//Prevent accidently buying multi
if (!Recharge.Instance.use(player, "Shop Purchase", 120, false, false))
return;
StrikeItem item = _shop.get(player).get(event.getSlot());
if (item == null)
return;
if (hasItem(player, item))
return;
if (getMoney(player) < item.getCost())
{
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1f, 1f);
return;
}
//Gun
if (item instanceof Gun)
{
Gun gun = (Gun)item;
Host.dropSlotItem(player, gun.getSlot());
gun.giveToPlayer(player);
Host.registerGun(gun, player);
}
//Grenade
else if (item instanceof Grenade)
{
Grenade grenade = (Grenade)item;
if (!grenade.giveToPlayer(player))
{
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1f, 1f);
return;
}
Host.registerGrenade(grenade, player);
}
else if (item instanceof Helmet)
{
((Helmet)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(100, 0, 0) : Color.fromRGB(0, 0, 100));
}
else if (item instanceof Kevlar)
{
((Kevlar)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(100, 0, 0) : Color.fromRGB(0, 0, 100));
}
else if (item instanceof DefusalKit)
{
item.giveToPlayer(player, 8);
}
_money.put(player, getMoney(player) - item.getCost());
enterShop(player);
}
public void leaveShop(Player player, boolean showShopItem, boolean wipeMoney)
{
_shop.remove(player);
_inShop.remove(player);
clearShopInventory(player);
if (wipeMoney)
_money.remove(player);
if (showShopItem)
{
player.getInventory().setItem(22,
ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte)0, 1, C.cRed + "Cannot Purchase Gear",
new String[]
{
C.cWhite + "",
C.cWhite + "You can only purchase gear when",
C.cWhite + "you are near your spawn point in",
C.cWhite + "the first 45 seconds of the round!",
}));
}
}
public boolean isBuyTime()
{
return !UtilTime.elapsed(Host.GetStateTime(), 45000) && Host.InProgress();
}
public void update()
{
for (Player player : Host.GetPlayers(true))
{
GameTeam team = Host.GetTeam(player);
if (team == null)
{
leaveShop(player, false, false);
continue;
}
//Near Shop?
boolean nearShop = false;
for (Location loc : team.GetSpawns())
{
if (UtilMath.offset(player.getLocation(), loc) < 5)
{
nearShop = true;
break;
}
}
//Leave Shop
if (_inShop.contains(player) && (!nearShop || !isBuyTime()))
{
leaveShop(player, true, false);
}
//Enter Shop
else if (!_inShop.contains(player) && (nearShop && isBuyTime()))
{
enterShop(player);
}
}
}
}

View File

@ -0,0 +1,86 @@
package nautilus.game.arcade.game.games.minestrike.data;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public class Bomb
{
public long BombTime = 45000;
public Block Block;
public long StartTime;
public long LastBeep;
public long MinBeepTime = 40;
public long StartBeepTime = 2000;
public Player Planter;
public Bomb(Player planter)
{
Planter = planter;
Block = planter.getLocation().getBlock();
Block.setType(Material.DAYLIGHT_DETECTOR);
StartTime = System.currentTimeMillis();
}
public boolean update()
{
double scale = (double)(System.currentTimeMillis() - StartTime)/(double)BombTime;
long beepDuration = MinBeepTime + (long)(StartBeepTime * (1-scale));
float volume = 1f + 4f*(float)scale;
if (UtilTime.elapsed(LastBeep, beepDuration))
{
Block.getWorld().playSound(Block.getLocation(), Sound.ANVIL_BREAK, volume, 1f);
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
LastBeep = System.currentTimeMillis();
}
if (UtilTime.elapsed(StartTime, BombTime))
{
Block.setType(Material.AIR);
//Effect
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, Block.getLocation(), 10f, 10f, 10f, 0, 30);
for (int i=0 ; i<3 ; i++)
Block.getWorld().playSound(Block.getLocation(), Sound.ANVIL_LAND, 20f, (float)(Math.random() * 0.5 + 0.5));
return true;
}
return false;
}
public boolean isBlock(Block block)
{
if (block == null)
return false;
return block.equals(Block);
}
public void defuse()
{
Block.setType(Material.AIR);
//Effect
UtilParticle.PlayParticle(ParticleType.CLOUD, Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
}
public void clean()
{
Block.setType(Material.AIR);
}
}

View File

@ -0,0 +1,51 @@
package nautilus.game.arcade.game.games.minestrike.data;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
public class Bullet
{
public Player Shooter;
public Entity Bullet;
public Gun Gun;
public Location Origin;
public long LastSound = System.currentTimeMillis() - 100;
public Bullet(Entity bullet, Gun gun, Player shooter, MineStrike game)
{
Bullet = bullet;
Gun = gun;
Origin = shooter.getEyeLocation();
Shooter = shooter;
}
public boolean isValid()
{
return Bullet.isValid();
}
public double getDamage(Location destination)
{
return Gun.getDamage() * (1 - (Gun.getDropOff() * UtilMath.offset(Origin, destination)));
}
public boolean bulletSound()
{
if (UtilTime.elapsed(LastSound, 250))
{
LastSound = System.currentTimeMillis();
return true;
}
return false;
}
}

View File

@ -0,0 +1,200 @@
package nautilus.game.arcade.game.games.minestrike.items;
import java.util.ArrayList;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public abstract class StrikeItem
{
private StrikeItemType _type;
private String _name;
private String[] _desc;
private int _cost;
private int _gemCost;
private Material _skin;
private ItemStack _stack = null;
public StrikeItem(StrikeItemType type, String name, String[] desc, int cost, int gemCost, Material skin)
{
_type = type;
_name = name;
_desc = desc;
_cost = cost;
_gemCost = gemCost;
_skin = skin;
//Make Stack
_stack = new ItemStack(skin);
fixStackName();
}
public StrikeItemType getType()
{
return _type;
}
public String getName()
{
return _name;
}
public String[] getDesc()
{
return _desc;
}
public int getCost()
{
return _cost;
}
public int getGemCost()
{
return _gemCost;
}
public Material getSkin()
{
return _skin;
}
public void drop(MineStrike game, Player player, boolean natural)
{
Entity ent;
if (natural)
{
ent = player.getWorld().dropItemNaturally(player.getEyeLocation(), _stack);
}
else
{
ent = player.getWorld().dropItem(player.getEyeLocation(), _stack);
UtilAction.velocity(ent, player.getLocation().getDirection(), 0.4, false, 0, 0.1, 1, false);
}
if (this instanceof Gun)
{
game.deregisterGun((Gun)this);
game.registerDroppedGun(ent, (Gun)this);
}
else if (this instanceof Grenade)
{
game.deregisterGrenade((Grenade)this);
game.registerDroppedGrenade(ent, (Grenade)this);
}
}
public ItemStack getStack()
{
return _stack;
}
public void setStack(ItemStack stack)
{
_stack = stack;
}
public boolean isHolding(Player player)
{
return UtilGear.isMat(player.getItemInHand(), _skin);
}
public boolean isStack(ItemStack stack)
{
return UtilGear.isMat(stack, _skin);
}
public void giveToPlayer(Player player, int slot)
{
fixStackName();
player.getInventory().setItem(slot, getStack());
UtilPlayer.message(player, F.main("Game", "You equipped " + getName() + "."));
player.getWorld().playSound(player.getLocation(), Sound.ITEM_PICKUP, 1.5f, 1f);
}
public void fixStackName()
{
ItemMeta meta = _stack.getItemMeta();
meta.setDisplayName(C.Bold + getName());
_stack.setItemMeta(meta);
}
public abstract boolean pickup(MineStrike game, Player player);
public ItemStack getShopItem(int money, boolean alreadyHas)
{
ArrayList<String> lore = new ArrayList<String>();
for (String cur : _desc)
lore.add(C.cWhite + cur);
//Custom (Gun Stats)
if (getShopItemCustom().length > 0)
{
lore.add(" ");
for (String cur : getShopItemCustom())
lore.add(C.cWhite + cur);
}
if (alreadyHas)
{
lore.add(" ");
lore.add(C.cYellow + C.Bold + "You already have this!");
}
else
{
lore.add(" ");
lore.add(C.cYellow + C.Bold + "Cost: " + ChatColor.RESET + "$" + _cost);
lore.add(" ");
lore.add(C.cYellow + C.Bold + "Money: " + ChatColor.RESET + "$" + money);
lore.add(" ");
lore.add((money >= _cost) ? C.cGreen + C.Bold + "Click to Purchase" : C.cRed + C.Bold + "Not enough Money");
}
String[] loreArray = new String[lore.size()];
loreArray = lore.toArray(loreArray);
String name = getShopItemType() + " " + C.cGreen + getName();
ItemStack item = ItemStackFactory.Instance.CreateStack(_skin, (byte)0, 1, name, loreArray);
if (alreadyHas)
UtilInv.addDullEnchantment(item);
return item;
}
public String[] getShopItemCustom()
{
return new String[] {};
}
public String getShopItemType()
{
return "";
}
}

View File

@ -0,0 +1,10 @@
package nautilus.game.arcade.game.games.minestrike.items;
public enum StrikeItemType
{
PRIMARY_WEAPON,
SECONDARY_WEAPON,
GRENADE,
EQUIPMENT,
ARMOR
}

View File

@ -0,0 +1,48 @@
package nautilus.game.arcade.game.games.minestrike.items.equipment;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
public class DefusalKit extends StrikeItem
{
public DefusalKit()
{
super(StrikeItemType.EQUIPMENT, "Defusal Kit", new String[]
{
"Halves the time it takes to defuse."
},
400, 0, Material.SHEARS);
}
@Override
public boolean pickup(MineStrike game, Player player)
{
return false;
}
public void giveToPlayer(Player player, int slot)
{
fixStackName();
player.getInventory().setItem(slot, getStack());
UtilPlayer.message(player, F.main("Game", "You equipped " + getName() + "."));
player.getWorld().playSound(player.getLocation(), Sound.HORSE_ARMOR, 1.5f, 1f);
}
@Override
public String getShopItemType()
{
return C.cDGreen + C.Bold + "Equipment" + ChatColor.RESET;
}
}

View File

@ -0,0 +1,71 @@
package nautilus.game.arcade.game.games.minestrike.items.equipment.armor;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
public class Armor extends StrikeItem
{
public Armor(String name, String[] desc, int cost, int gemCost, Material skin)
{
super(StrikeItemType.ARMOR, name, desc, cost, gemCost, skin);
}
@Override
public boolean pickup(MineStrike game, Player player)
{
return false;
}
public void giveToPlayer(Player player, Color color)
{
ItemStack armor = new ItemStack(getSkin());
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
meta.setColor(color);
meta.setDisplayName(getName());
armor.setItemMeta(meta);
if (getSkin() == Material.LEATHER_CHESTPLATE)
player.getInventory().setChestplate(armor);
else
player.getInventory().setHelmet(armor);
UtilPlayer.message(player, F.main("Game", "You equipped " + getName() + "."));
player.getWorld().playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f);
}
public static boolean isArmor(ItemStack stack)
{
if (stack == null)
return false;
try
{
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
return (meta.getColor().getBlue() == 100 || meta.getColor().getRed() == 100);
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
}
@Override
public String getShopItemType()
{
return C.cDGreen + C.Bold + "Armor" + ChatColor.RESET;
}
}

View File

@ -0,0 +1,16 @@
package nautilus.game.arcade.game.games.minestrike.items.equipment.armor;
import org.bukkit.Material;
public class Helmet extends Armor
{
public Helmet()
{
super("Helmet", new String[]
{
"Reduces damage from headshots"
},
350, 0, Material.LEATHER_HELMET);
}
}

View File

@ -0,0 +1,16 @@
package nautilus.game.arcade.game.games.minestrike.items.equipment.armor;
import org.bukkit.Material;
public class Kevlar extends Armor
{
public Kevlar()
{
super("Kevlar", new String[]
{
"Reduces bullet damage by 25%"
},
350, 0, Material.LEATHER_CHESTPLATE);
}
}

View File

@ -0,0 +1,80 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.HashMap;
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.UtilPlayer;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public class FlashBang extends Grenade
{
public FlashBang()
{
super("Flash Bang", new String[]
{
},
200, 0, Material.CARROT_ITEM, 2);
}
@Override
public boolean updateCustom(MineStrike game, Entity ent)
{
if (ent.getTicksLived() > 40)
{
FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(Color.WHITE).with(Type.BALL_LARGE).trail(false).build();
UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect);
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 48);
for (Player player : players.keySet())
{
if (!game.IsAlive(player))
continue;
//Line of Sight
Location loc = player.getEyeLocation();
boolean sight = true;
while (UtilMath.offset(loc, ent.getLocation()) > 0.5)
{
if (UtilBlock.solid(loc.getBlock()))
{
sight = false;
break;
}
loc.add(UtilAlg.getTrajectory(loc, ent.getLocation()).multiply(0.2));
}
if (!sight)
continue;
//Calculate if player is looking away
Location eyeToGrenade = player.getEyeLocation().add(UtilAlg.getTrajectory(player.getEyeLocation(), ent.getLocation()));
double flashIntensity = 2 - UtilMath.offset(player.getEyeLocation().add(player.getLocation().getDirection()), eyeToGrenade);
//Duration
double duration = (2 + (3 * (players.get(player)))) * flashIntensity;
duration += 1;
//Blind
game.Manager.GetCondition().Factory().Blind(getName(), player, _thrower, duration, 0, false, false, false);
}
return true;
}
return false;
}
}

View File

@ -0,0 +1,198 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
public abstract class Grenade extends StrikeItem
{
protected Player _thrower = null;
protected Vector _vel;
protected Location _lastLoc;
protected ArrayList<Vector> _velHistory = new ArrayList<Vector>();
protected int _limit;
public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit)
{
super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin);
_limit = limit;
}
public boolean giveToPlayer(Player player)
{
int slot = 3;
int alreadyHas = 0;
while (player.getInventory().getItem(slot) != null && player.getInventory().getItem(slot).getType() != Material.AIR && slot <= 6)
{
if (player.getInventory().getItem(slot).getType() == getSkin())
{
alreadyHas++;
if (alreadyHas >= _limit)
return false;
}
slot++;
}
if (slot > 6)
return false;
giveToPlayer(player, slot);
return true;
}
public boolean canGiveToPlayer(Player player)
{
int slot = 3;
int alreadyHas = 0;
while (player.getInventory().getItem(slot) != null && player.getInventory().getItem(slot).getType() != Material.AIR && slot <= 6)
{
if (player.getInventory().getItem(slot).getType() == getSkin())
{
alreadyHas++;
if (alreadyHas >= _limit)
return false;
}
slot++;
}
if (slot > 6)
return false;
return true;
}
public void throwGrenade(Player player, boolean wasLeftClick, MineStrike game)
{
player.setItemInHand(null);
_thrower = player;
Entity ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), getStack());
if (wasLeftClick)
UtilAction.velocity(ent, player.getLocation().getDirection(), 0.4, false, 0, 0, 2, false);
else
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 2, false);
//Rebound Data
_vel = player.getLocation().getDirection();
_velHistory.add(_vel);
_lastLoc = ent.getLocation();
UtilPlayer.message(player, F.main("Game", "You threw " + getName() + "."));
game.registerThrownGrenade(ent, this);
game.deregisterGrenade(this);
}
public boolean update(MineStrike game, Entity ent)
{
//Invalid
if (!ent.isValid())
return true;
//Rebound Off Blocks
rebound(ent);
//Custom
if (updateCustom(game, ent))
return true;
return false;
}
public void rebound(Entity ent)
{
if (UtilEnt.isGrounded(ent) || ent.getVelocity().length() < 0.1 || ent.getTicksLived() < 4)
return;
/*
* What we must do here, is record the velocity every tick.
* Then when it collides, we get the velocity from a few ticks before and apply it, reversing the direction of collision.
* We record history because as soon as it collides the collision direction is set to 0.
*/
//X Rebound
if ((_vel.getX() > 0 && ent.getLocation().getX() - _lastLoc.getX() <= 0) ||
(_vel.getX() < 0 && ent.getLocation().getX() - _lastLoc.getX() >= 0))
{
_vel = _velHistory.get(0);
_vel.setX(-_vel.getX());
_vel.multiply(0.75);
ent.setVelocity(_vel);
ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f);
}
//Z Rebound
else if ((_vel.getZ() > 0 && ent.getLocation().getZ() - _lastLoc.getZ() <= 0) ||
(_vel.getZ() < 0 && ent.getLocation().getZ() - _lastLoc.getZ() >= 0))
{
_vel = _velHistory.get(0);
_vel.setZ(-_vel.getZ());
_vel.multiply(0.75);
ent.setVelocity(_vel);
ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f);
}
else
{
_velHistory.add(ent.getVelocity());
while (_velHistory.size() > 4)
_velHistory.remove(0);
}
_lastLoc = ent.getLocation();
}
public abstract boolean updateCustom(MineStrike game, Entity ent);
@Override
public boolean pickup(MineStrike game, Player player)
{
if (giveToPlayer(player))
{
game.registerGrenade(this, player);
game.deregisterDroppedGrenade(this);
}
return false;
}
@Override
public String getShopItemType()
{
return C.cDGreen + C.Bold + "Grenade" + ChatColor.RESET;
}
}

View File

@ -0,0 +1,55 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.HashMap;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class HighExplosive extends Grenade
{
public HighExplosive()
{
super("HE Grenade", new String[]
{
},
300, 0, Material.APPLE, 1);
}
@Override
public boolean updateCustom(MineStrike game, Entity ent)
{
if (ent.getTicksLived() > 40)
{
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION,
ent.getLocation(), 0, 0, 0, 0, 1);
ent.getWorld().playSound(ent.getLocation(),
Sound.EXPLODE, 3f, 0.8f);
HashMap<Player, Double> players = UtilPlayer.getInRadius(
ent.getLocation(), 8);
for (Player player : players.keySet())
{
if (!game.IsAlive(player))
continue;
// Damage Event
game.Manager.GetDamage().NewDamageEvent(player, _thrower, null,
DamageCause.CUSTOM, 1 + (players.get(player) * 18),
true, true, false, _thrower.getName(), getName());
}
return true;
}
return false;
}
}

View File

@ -0,0 +1,48 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.HashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class Incendiary extends Grenade
{
public Incendiary()
{
super("HE Grenade", new String[]
{
},
300, 0, Material.APPLE, 1);
}
@Override
public boolean updateCustom(MineStrike game, Entity ent)
{
if (UtilEnt.isGrounded(ent))
{
createFire(ent.getLocation().getBlock());
return true;
}
return false;
}
private void createFire(Block block)
{
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,6 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades;
public class Molotov
{
}

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
public class Smoke extends Grenade
{
public Smoke()
{
super("Smoke Grenade", new String[]
{
},
300, 0, Material.POTATO_ITEM, 1);
}
@Override
public boolean updateCustom(MineStrike game, Entity ent)
{
if (ent.getTicksLived() > 60)
{
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0, 0, 0, 0, 1);
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
return false;
}
return ent.getTicksLived() > 360;
}
}

View File

@ -0,0 +1,371 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.recharge.RechargedEvent;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.Vector;
public abstract class Gun extends StrikeItem
{
protected GunType _gunType;
protected int _slot;
//Stats
protected int _clipSize;
protected int _clipReserve;
protected long _fireRate;
protected long _reloadTime;
protected double _damage;
protected double _dropOffPerBlock;
protected double _bulletSpeed;
protected Sound _fireSound;
protected double _coneMin;
protected double _coneMax;
protected double _coneReduceRate;
protected double _coneIncreaseRate;
//Active Data
protected int _loadedAmmo;
protected int _reserveAmmo;
protected double _cone;
protected double _lastMove;
protected long _lastMoveTime;
public Gun(StrikeItemType type, GunType gunType, String name, String[] desc,
int cost, int gemCost,
int clipSize, int clipReserve,
long fireRate, long reloadTime,
double damage, double dropOffPerBlock, double bulletSpeed,
double coneMin, double coneMax,
double coneIncrease, double coneReduce,
Material skin, Sound sound)
{
super(type, name, desc, cost, gemCost, skin);
_gunType = gunType;
if (type == StrikeItemType.PRIMARY_WEAPON)
_slot = 0;
else
_slot = 1;
_clipSize = clipSize;
_clipReserve = clipReserve;
_fireRate = fireRate;
_reloadTime = reloadTime;
_damage = damage;
_dropOffPerBlock = dropOffPerBlock;
_bulletSpeed = bulletSpeed;
_fireSound = sound;
_coneMin = coneMin;
_coneMax = coneMax;
_coneIncreaseRate = coneIncrease;
_coneReduceRate = coneReduce;
_cone = _coneMin;
_loadedAmmo = clipSize;
_reserveAmmo = clipReserve * clipSize;
updateWeaponName(null);
}
public void shoot(final Player player, final MineStrike game)
{
//Standard (300) RPM
shootOnce(player, game);
//600RPM
if (_fireRate <= 100 && _fireRate > 50)
{
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.GetPlugin(), new Runnable()
{
public void run()
{
shootOnce(player, game);
}
}, 2);
}
//1200RPM
if (_fireRate <= 50)
{
for (int i=1 ; i<4 ; i++)
{
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.GetPlugin(), new Runnable()
{
public void run()
{
shootOnce(player, game);
}
}, i);
}
}
}
public void shootOnce(Player player, MineStrike game)
{
//Check Ammo
if (!ammoCheck(player))
return;
if (!Recharge.Instance.use(player, getName() + " Shoot", _fireRate, false, false))
return;
//Use Ammo
_loadedAmmo--;
updateWeaponName(player);
//Effect
soundFire(player.getLocation());
for (Player other : UtilServer.getPlayers())
if (!player.equals(other))
UtilParticle.PlayParticle(other, ParticleType.EXPLODE, player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.5)), 0, 0, 0, 0, 1);
game.registerBullet(fireBullet(player, game));
}
public Bullet fireBullet(Player player, MineStrike game)
{
//Shoot
Entity bullet = player.launchProjectile(Arrow.class);
//COF
double cone = getCone(player);
//Calc
Vector cof = new Vector(Math.random() - 0.5, (Math.random() - 0.2) * (5d/8d), Math.random() - 0.5);
cof.normalize();
cof.multiply(cone);
cof.add(player.getLocation().getDirection());
cof.normalize();
bullet.setVelocity(cof.multiply(game.isInstantBullets() ? 200 : _bulletSpeed));
//Increase COF
_cone = Math.min(_coneMax, _cone + _coneIncreaseRate);
return new Bullet(bullet, this, player, game);
}
public double getCone(Player player)
{
double cone = _cone;
//Move Penalty
if (!UtilTime.elapsed(_lastMoveTime, 75))
cone += _lastMove * _gunType.getMovePenalty();
//Sprint Penalty
if (player.isSprinting())
cone += _gunType.getSprintPenalty();
//Airborne Penalty
else if (!UtilEnt.isGrounded(player))
cone += _gunType.getJumpPenalty();
//Crouch
else if (player.isSneaking() && _gunType != GunType.SNIPER)
cone = cone * 0.8;
//Sniper Zoomed
if (_gunType == GunType.SNIPER)
{
if (player.isSneaking())
{
cone -= _cone;
}
}
return cone;
}
public boolean ammoCheck(Player player)
{
if (_loadedAmmo > 0)
return true;
//Sound
if (Recharge.Instance.use(player, getName() + " Ammo Tick", 200, false, false))
soundEmpty(player.getLocation());
return false;
}
public void reload(Player player)
{
if (_loadedAmmo == _clipSize)
return;
int ammo = _reserveAmmo + _loadedAmmo;
if (ammo == 0)
{
UtilPlayer.message(player, F.main("Gun", "You have no ammo for " + F.name(getName()) + "."));
return;
}
_loadedAmmo = Math.min(ammo, _clipSize);
_reserveAmmo = Math.max(0, ammo - _clipSize);
//Recharge
Recharge.Instance.useForce(player, getName() + " Shoot", _reloadTime);
Recharge.Instance.use(player, getName() + " Reload", _reloadTime, false, true);
//Sound
soundReload(player.getLocation());
//Update
updateWeaponName(player);
}
@Override
public void fixStackName()
{
updateWeaponName(null);
}
public void updateWeaponName(Player player)
{
ItemMeta meta = getStack().getItemMeta();
meta.setDisplayName(C.Bold + getName() + ChatColor.RESET + " " + C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo);
getStack().setItemMeta(meta);
if (player != null)
player.getInventory().setItem(_slot, getStack());
}
public double getDamage()
{
return _damage;
}
public double getDropOff()
{
return _dropOffPerBlock;
}
public void soundFire(Location loc)
{
loc.getWorld().playSound(loc, _fireSound, _gunType.getVolume(), (float)(Math.random() * 0.2 + 0.9));
}
public void soundEmpty(Location loc)
{
loc.getWorld().playSound(loc, Sound.NOTE_STICKS, 1f, 2f);
loc.getWorld().playSound(loc, Sound.NOTE_STICKS, 1f, 2f);
loc.getWorld().playSound(loc, Sound.NOTE_STICKS, 1f, 2f);
}
public void soundReload(Location loc)
{
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 1f, 0.8f);
}
public void soundReloaded(Location loc)
{
loc.getWorld().playSound(loc, Sound.PISTON_EXTEND, 1f, 1.6f);
}
public void soundRefire(Location loc)
{
}
public void giveToPlayer(Player player)
{
giveToPlayer(player, _slot);
}
public int getSlot()
{
return _slot;
}
public void moveEvent(PlayerMoveEvent event)
{
double dist = UtilMath.offset(event.getFrom(), event.getTo());
_lastMove = dist;
_lastMoveTime = System.currentTimeMillis();
}
public void reduceCone()
{
_cone = Math.max(_coneMin, _cone - (_coneReduceRate / 20d));
}
public void reloadEvent(RechargedEvent event)
{
if (!isHolding(event.GetPlayer()))
return;
if (event.GetAbility().equals(getName() + " Shoot"))
{
soundRefire(event.GetPlayer().getEyeLocation());
}
else if (event.GetAbility().equals(getName() + " Reload"))
{
soundReloaded(event.GetPlayer().getEyeLocation());
}
}
@Override
public boolean pickup(MineStrike game, Player player)
{
if (player.getInventory().getItem(_slot) != null && player.getInventory().getItem(_slot).getType() != Material.AIR)
return false;
giveToPlayer(player);
game.registerGun(this, player);
game.deregisterDroppedGun(this);
return true;
}
public void restockAmmo(Player player)
{
_loadedAmmo = _clipSize;
_reserveAmmo = _clipReserve * _clipSize;
updateWeaponName(player);
player.setHealth(20);
}
@Override
public String getShopItemType()
{
return C.cDGreen + C.Bold + _gunType.getName() + ChatColor.RESET;
}
}

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
public enum GunType
{
PISTOL("Pistol", 0.06, 0.04, 0.08, 3f),
SHOTGUN("Shotgun", 0, 0, 0, 3f),
SMG("SMG", 0.08, 0.05, 0.1, 3f),
RIFLE("Rifle", 0.1, 0.06, 0.12, 3.5f),
SNIPER("Sniper Rifle", 0.16, 0.08, 0.16, 4f);
private String _name;
private double _movePenalty;
private double _sprintPentalty;
private double _jumpPenalty;
private float _volume;
GunType(String name, double move, double sprint, double jump, float volume)
{
_name = name;
_movePenalty = move;
_sprintPentalty = sprint;
_jumpPenalty = jump;
_volume = volume;
}
public String getName()
{
return _name;
}
public double getMovePenalty()
{
return _movePenalty;
}
public double getSprintPenalty()
{
return _sprintPentalty;
}
public double getJumpPenalty()
{
return _jumpPenalty;
}
public float getVolume()
{
return _volume;
}
}

View File

@ -0,0 +1,74 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;
public abstract class Shotgun extends Gun
{
private int _pellets;
public Shotgun(StrikeItemType type, String name, String[] desc,
int cost, int gemCost,
int clipSize, int spareAmmo,
long fireRate, long reloadTime, double damage,
double dropOffPerBlock, double bulletSpeed, double coneMin,
double coneMax, double coneIncrease, double coneReduce,
Material skin, Sound sound, int pellets)
{
super(type, GunType.SHOTGUN, name, desc, cost, gemCost, clipSize, spareAmmo, fireRate, reloadTime, damage,
dropOffPerBlock, bulletSpeed, coneMin, coneMax, coneIncrease,
coneReduce, skin, sound);
_pellets = pellets;
}
@Override
public void shoot(Player player, MineStrike game)
{
//Check Ammo
if (!ammoCheck(player))
return;
if (!Recharge.Instance.use(player, getName() + " Shoot", _fireRate, false, false))
return;
//Use Ammo
_loadedAmmo--;
updateWeaponName(player);
//Effect
soundFire(player.getLocation());
UtilParticle.PlayParticle(ParticleType.CLOUD, player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.5)), 0, 0, 0, 0, 1);
for (int i=0 ; i<_pellets ; i++)
game.registerBullet(fireBullet(player, game));
}
@Override
public void soundRefire(Location loc)
{
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 0.8f, 1.2f);
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 0.8f, 1.2f);
}
@Override
public double getCone(Player player)
{
return _cone;
}
@Override
public void moveEvent(PlayerMoveEvent event)
{
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.pistol;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
public class CZ75 extends Gun
{
public CZ75()
{
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "CZ75-Auto", new String[]
{
},
300, 0, //Cost, Gem Cost
12, 1, //Clip Size, Spare Ammo
80, 2700, //ROF, Reload Time
6, 0.01, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.15, //COF Min, COF Max
0.06, 0.4, //COF Inc per Bullet, COF Dec per Second
Material.IRON_HOE, Sound.ENDERMAN_DEATH);
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.pistol;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
public class Deagle extends Gun
{
public Deagle()
{
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "Desert Eagle", new String[]
{
},
800, 0, //Cost, Gem Cost
7, 5, //Clip Size, Spare Ammo
300, 2000, //ROF, Reload Time
9, 0.01, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.2, //COF Min, COF Max
0.12, 0.2, //COF Inc per Bullet, COF Dec per Second
Material.GOLD_HOE, Sound.BAT_DEATH);
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.pistol;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
public class Glock18 extends Gun
{
public Glock18()
{
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "Glock 18", new String[]
{
},
0, 0, //Cost, Gem Cost
20, 6, //Clip Size, Spare Ammo
120, 2000, //ROF, Reload Time
5, 0.01, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.15, //COF Min, COF Max
0.08, 0.3, //COF Inc per Bullet, COF Dec per Second
Material.STONE_HOE, Sound.BAT_LOOP);
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.pistol;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
public class P2000 extends Gun
{
public P2000()
{
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "P2000", new String[]
{
},
0, 0, //Cost, Gem Cost
13, 4, //Clip Size, Spare Ammo
130, 2200, //ROF, Reload Time
6, 0.01, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.15, //COF Min, COF Max
0.08, 0.3, //COF Inc per Bullet, COF Dec per Second
Material.WOOD_HOE, Sound.GHAST_SCREAM2);
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.rifle;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
public class AK47 extends Gun
{
public AK47()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "AK-47", new String[]
{
},
2700, 5000, //Cost, Gem Cost
30, 3, //Clip Size, Spare Ammo
80, 3600, //ROF, Reload Time
7.5, 0.005, 4, //Damage, Dropoff, Bullet Speed
0, 0.25, //COF Min, COF Max
0.050, 0.4, //COF Inc per Bullet, COF Dec per Second
Material.WOOD_SPADE, Sound.BURP);
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.rifle;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
public class AWP extends Gun
{
public AWP()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.SNIPER, "AWP", new String[]
{
},
4750, 5000, //Cost, Gem Cost
10, 3, //Clip Size, Spare Ammo
1500, 3600, //ROF, Reload Time
30, 0.002, 4.3, //Damage, Dropoff, Bullet Speed
0.05, 0.05, //COF Min, COF Max
0, 0, //COF Inc per Bullet, COF Dec per Second
Material.GOLD_SPADE, Sound.DRINK);
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.rifle;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
public class M4A1 extends Gun
{
public M4A1()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "M4A4", new String[]
{
},
2900, 5000, //Cost, Gem Cost
30, 3, //Clip Size, Spare Ammo
80, 3600, //ROF, Reload Time
7, 0.005, 4, //Damage, Dropoff, Bullet Speed
0, 0.2, //COF Min, COF Max
0.048, 0.4, //COF Inc per Bullet, COF Dec per Second
Material.STONE_SPADE, Sound.BAT_TAKEOFF);
}
}

View File

@ -0,0 +1,26 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.shotgun;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Shotgun;
public class Nova extends Shotgun
{
public Nova()
{
super(StrikeItemType.PRIMARY_WEAPON, "Nova", new String[]
{
},
1200, 5000, //Cost, Gem Cost
8, 4, //Clip Size, Spare Ammo
1000, 4000, //ROF, Reload Time
5, 0.02, 3.5, //Damage, Dropoff, Bullet Speed
0.15, 0.15, //COF Min, COF Max
0, 0, //COF Inc per Bullet, COF Dec per Second
Material.GOLD_AXE, Sound.BLAZE_DEATH, 9);
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.game.games.minestrike.items.guns.smg;
import org.bukkit.Material;
import org.bukkit.Sound;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
public class P90 extends Gun
{
public P90()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.SMG, "P90", new String[]
{
},
2350, 5000, //Cost, Gem Cost
50, 2, //Clip Size, Spare Ammo
35, 2800, //ROF, Reload Time
4, 0.02, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.2, //COF Min, COF Max
0.03, 0.4, //COF Inc per Bullet, COF Dec per Second
Material.STONE_AXE, Sound.CREEPER_DEATH);
}
}

View File

@ -0,0 +1,50 @@
package nautilus.game.arcade.game.games.minestrike.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitPlayer extends Kit
{
public KitPlayer(ArcadeManager manager)
{
super(manager, "Player", KitAvailability.Free,
new String[]
{
C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Fire Gun",
C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Reload Gun",
C.cGreen + "Crouch" + C.cWhite + " - " + C.cYellow + "Sniper Scope",
"",
C.cGreen + "Hold Right-Click with Bomb" + C.cWhite + " - " + C.cRed + "Plant Bomb",
C.cGreen + "Hold Right-Click with Knife" + C.cWhite + " - " + C.cAqua + "Defuse Bomb",
},
new Perk[]
{
},
EntityType.PLAYER,
new ItemStack(Material.AIR));
}
@Override
public void GiveItems(Player player)
{
}
@Override
public void SpawnCustom(LivingEntity ent)
{
}
}

View File

@ -278,18 +278,6 @@ public class SneakyAssassins extends SoloGame
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onHangingBreak(HangingBreakEvent event)
{
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event)
{
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onPlayerInteractHanging(PlayerInteractEntityEvent event)
{
@ -297,13 +285,6 @@ public class SneakyAssassins extends SoloGame
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onDamageHanging(EntityDamageEvent event)
{
if (event.getEntity() instanceof Hanging)
event.setCancelled(true);
}
@EventHandler(ignoreCancelled = true)
public void onWitherEffectDamager(CustomDamageEvent event)
{

View File

@ -187,10 +187,12 @@ public class Spleef extends SoloGame
public void BlockFade(Block block, Player player, boolean slowDamage)
{
if (block.getTypeId() == 7)
return;
//Prevent Super Hunger from Bow
if (Recharge.Instance.use(player, GetName() + " Hunger", 50, false, false))
if (block.getTypeId() != 7)
UtilPlayer.hunger(player, 1);
UtilPlayer.hunger(player, 1);
if (!slowDamage)
{

View File

@ -119,7 +119,7 @@ public class GameFlagManager implements Listener
{
if (!Manager.CanHurt((Player)damagee, (Player)damager))
{
event.SetCancelled("Damage Rules");
event.SetCancelled("PvP Disabled");
return;
}
}
@ -253,7 +253,7 @@ public class GameFlagManager implements Listener
}
@EventHandler(priority = EventPriority.LOWEST)
public void InventoryOpen(InventoryClickEvent event)
public void InventoryClick(InventoryClickEvent event)
{
Game game = Manager.GetGame();
if (game == null)
@ -262,6 +262,10 @@ public class GameFlagManager implements Listener
if (!game.InProgress())
return;
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
if (player != null && !game.IsAlive(player))
return;
if (game.InventoryClick)
return;
@ -560,7 +564,7 @@ public class GameFlagManager implements Listener
final Player player = event.getEntity();
//Visual
Manager.GetCondition().Factory().Blind("Ghost", player, player, 1.5, 0, false, false, false);
Manager.GetCondition().Factory().Blind("Ghost", player, player, 2, 0, false, false, false);
player.setFireTicks(0);
player.setFallDistance(0);

View File

@ -108,7 +108,7 @@ public class GameManager implements Listener
System.out.println("Game Load Expired.");
game.SetState(GameState.Dead);
}
}
}
else if (game.GetState() == GameState.Recruit)
{
//Stop Countdown!

View File

@ -68,7 +68,6 @@ public class GamePlayerManager implements Listener
event.GetLog().SetKillerColor(Manager.GetColor(player)+"");
}
if (event.GetEvent().getEntity() instanceof Player)
{
Player player = (Player)event.GetEvent().getEntity();

View File

@ -59,10 +59,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Data\ContextExtensions.cs" />
<Compile Include="Data\IRepository.cs" />
<Compile Include="Data\IRepositoryFactory.cs" />
<Compile Include="Data\Repository.cs" />
<Compile Include="Data\RepositoryFactory.cs" />
<Compile Include="Model\Account\Account.cs" />
<Compile Include="Model\Account\OwnedPet.cs" />
<Compile Include="Model\Account\Punishment.cs" />

View File

@ -7,6 +7,7 @@
using System.Data.Entity.Validation;
using System.Linq;
using System.Linq.Expressions;
using LOC.Website.Common;
public class Repository<TContext> : IRepository
where TContext : DbContext
@ -56,12 +57,14 @@
catch (DbEntityValidationException ex)
{
var l = (from err in ex.EntityValidationErrors from ve in err.ValidationErrors select ve.ErrorMessage).ToList();
Log("ERROR", PREFIX + String.Join("; ", l));
throw new ApplicationException(PREFIX + String.Join("; ", l), ex); // contains the human-readable validation exception
}
catch (DbUpdateException e)
{
if (e.InnerException != null && e.InnerException.InnerException != null && !String.IsNullOrEmpty(e.InnerException.InnerException.Message))
{
Log("ERROR", PREFIX + String.Join("; ", e.InnerException.InnerException.Message));
throw new ApplicationException(PREFIX + String.Join("; ", e.InnerException.InnerException.Message), e); // contains the reason
}
throw;
@ -121,6 +124,17 @@
}
}
}
private void Log(string category, string message)
{
Add(new LogEntry
{
Date = DateTime.Now,
Category = category,
Message = message
});
CommitChanges();
}
}
}

View File

@ -68,6 +68,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Contexts\IRepository.cs" />
<Compile Include="Contexts\IRepositoryFactory.cs" />
<Compile Include="Contexts\Repository.cs" />
<Compile Include="Contexts\RepositoryFactory.cs" />
<Compile Include="ILogger.cs" />
<Compile Include="Logger.cs" />
<Compile Include="PingResult.cs" />
<Compile Include="PunishmentResponse.cs" />
<Compile Include="CaptureThePigStatsDisplay.cs" />
@ -95,8 +101,6 @@
<Compile Include="Models\ISalesPackageAdministrator.cs" />
<Compile Include="Models\IServerAdministrator.cs" />
<Compile Include="Models\IAccountAdministrator.cs" />
<Compile Include="ILogger.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Models\PetAdministrator.cs" />
<Compile Include="Models\PvpAdministrator.cs" />
<Compile Include="Models\SalesPackageAdministrator.cs" />

View File

@ -92,12 +92,14 @@
account.Name = loginToken.Name;
}
/*
// Expire ranks
if ((account.Rank.Name == "ULTRA" || account.Rank.Name == "HERO") && !account.RankPerm && DateTime.Now.CompareTo(account.RankExpire) >= 0)
{
account.Rank = repository.Where<Rank>(x => x.Name == "ALL").First();
repository.Attach(account.Rank);
}
* */
repository.CommitChanges();
@ -538,10 +540,12 @@
public string UpdateRank(RankUpdateToken token)
{
Rank rank = null;
using (var repository = _repositoryFactory.CreateRepository())
{
var account = repository.Where<Account>(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault();
var rank = repository.Where<Rank>(x => String.Equals(x.Name, token.Rank)).FirstOrDefault();
rank = repository.Where<Rank>(x => String.Equals(x.Name, token.Rank)).FirstOrDefault();
if (account == null)
return "ALL";
@ -556,11 +560,10 @@
account.RankExpire = DateTime.Now.AddMonths(1);
account.RankPerm = token.Perm;
if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm == true)
{
repository.Attach(account);
repository.Edit(account);
repository.Edit(account);
if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm)
{
addAccountTransaction(repository, account, "Bacon Brawl Bebe Piggles", 0, 0);
addAccountTransaction(repository, account, "Bacon Brawl `Pig`", 0, 0);
addAccountTransaction(repository, account, "A Barbarians Life Barbarian Archer", 0, 0);
@ -628,9 +631,17 @@
}
repository.CommitChanges();
return rank.Name.ToString();
_logger.Log("INFO", "TOKEN " + token.Name + "'s rank has been updated to " + token.Rank + " " + (token.Perm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString());
}
using (var repository = _repositoryFactory.CreateRepository())
{
var account = repository.Where<Account>(x => String.Equals(x.Name, token.Name)).Include(x => x.Rank).FirstOrDefault();
_logger.Log("INFO", "ACCOUNT " + account.Name + "'s rank is " + account.Rank.Name + " " + (account.RankPerm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString());
}
return rank.Name.ToString();
}
public void RemoveBan(RemovePunishmentToken token)

File diff suppressed because it is too large Load Diff

Binary file not shown.