Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2014-11-05 14:45:54 -08:00
commit 6f2a6a6ebd
57 changed files with 1637 additions and 247 deletions

View File

@ -22,6 +22,11 @@ public class UtilAlg
return sortedSet;
}
public static Location getMidpoint(Location a, Location b)
{
return a.add(b.subtract(a).multiply(0.5));
}
public static Vector getTrajectory(Entity from, Entity to)
{
return getTrajectory(from.getLocation().toVector(), to.getLocation().toVector());
@ -179,4 +184,6 @@ public class UtilAlg
{
return cross(vec, getRight(vec));
}
}

View File

@ -172,7 +172,7 @@ public enum Achievement
DRAW_MY_THING_PURE_LUCK("Pure Luck", 800,
new String[]{"Draw My Thing.PureLuck"},
new String[]{"Guess a word in the first 5 seconds"},
new String[]{"Guess a word in the first 8 seconds"},
new int[]{1},
AchievementCategory.DRAW_MY_THING),
@ -492,14 +492,14 @@ public enum Achievement
SNEAK_ASSASSINS_INCOMPETENCE("Incompetence", 600,
new String[]{"Sneaky Assassins.Incompetence"},
new String[]{"Kill 500 NPCs."},
new int[]{500},
new String[]{"Kill 200 NPCs."},
new int[]{200},
AchievementCategory.SNEAKY_ASSASSINS),
SNEAK_ASSASSINS_I_SEE_YOU("I See You", 800,
new String[]{"Sneaky Assassins.ISeeYou"},
new String[]{"Reveal 250 players."},
new int[]{250},
new String[]{"Reveal 50 players."},
new int[]{50},
AchievementCategory.SNEAKY_ASSASSINS),
//Micro Battle

View File

@ -45,7 +45,7 @@ public class AntiHack extends MiniPlugin
public static AntiHack Instance;
private boolean _enabled = true;
private boolean _strict = true;
private boolean _strict = false;
private boolean _kick = true;
public Punish Punish;

View File

@ -0,0 +1,25 @@
package mineplex.core.data;
import org.bukkit.block.Block;
import org.bukkit.Material;
public class BlockData
{
public Block Block;
public Material Material;
public byte Data;
public long Time;
public BlockData(Block block)
{
Block = block;
Material = block.getType();
Data = block.getData();
Time = System.currentTimeMillis();
}
public void restore()
{
Block.setTypeIdAndData(Material.getId(), Data, true);
}
}

View File

@ -92,7 +92,7 @@ public class ParticleFoot extends ParticleGadget
UtilParticle.PlayParticle(ParticleType.FOOTSTEP, loc, 0f, 0f, 0f, 0, 1);
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc.add(0, 0.1, 0), 0f, 0f, 0f, 0, 1);
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, loc.clone().add(0, 0.1, 0), 0f, 0f, 0f, 0, 1);
}
}

View File

@ -1,6 +1,7 @@
package mineplex.core.inventory;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -75,9 +76,26 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
addItemToInventoryForOffline(player.getUniqueId().toString(), category, item, count);
}
public Item getItem(String itemName)
{
Item item = null;
for (Map.Entry<String, Item> entry : _items.entrySet())
{
String name = entry.getKey();
if (name.equalsIgnoreCase(itemName))
item = entry.getValue();
System.out.println(name + " " + entry.getValue().Category);
}
return item;
}
public void addItemToInventoryForOffline(final String uuidString, final String category, final String item, final int count)
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{
public void run()
{
@ -89,9 +107,9 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
System.out.println("InventoryManager Adding Category : " + category);
}
}
updateCategories();
synchronized (_inventoryLock)
{
if (!_items.containsKey(item))
@ -100,12 +118,12 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
System.out.println("InventoryManager Adding Item : " + item);
}
}
updateItems();
synchronized (_inventoryLock)
{
_repository.incrementClientInventoryItem(uuidString, _items.get(item).Id, count);
_repository.incrementClientInventoryItem(uuidString, _items.get(item).Id, count);
}
}
});

View File

@ -10,6 +10,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.inventory.data.Item;
/**
* Created by Shaun on 10/26/2014.
@ -18,7 +19,7 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
{
public GiveItemCommand(InventoryManager plugin)
{
super(plugin, Rank.ADMIN, "giveitem");
super(plugin, Rank.DEVELOPER, "giveitem");
}
@Override
@ -32,18 +33,24 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
final String playerName = args[0];
final int amount = Integer.parseInt(args[1]);
String tempItemName = "";
String itemName = "";
for (int i = 2; i < args.length; i++)
{
tempItemName += args[i] + " ";
itemName += args[i] + " ";
}
final String itemName = tempItemName.trim();
itemName = itemName.trim();
Item item = Plugin.getItem(itemName);
Player player = UtilPlayer.searchExact(playerName);
if (player != null)
if (item == null)
{
Plugin.addItemToInventory(player, "Item", itemName, amount);
UtilPlayer.message(caller, F.main("Item", "Item with the name " + F.item(itemName) + " not found!"));
}
else if (player != null)
{
Plugin.addItemToInventory(player, item.Category, item.Name, amount);
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to player " + F.name(playerName)));
UtilPlayer.message(player, F.main("Item", F.name(caller.getName()) + " gave you " + F.elem(amount + " " + itemName)));
}
@ -52,7 +59,7 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
if (uuid != null)
{
Plugin.addItemToInventoryForOffline(uuid.toString(), "Item", itemName, amount);
Plugin.addItemToInventoryForOffline(uuid.toString(), item.Category, item.Name, amount);
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to offline player " + F.name(playerName)));
}
else
@ -64,6 +71,6 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
private void displayUsage(Player caller)
{
UtilPlayer.message(caller, F.main("Item", "Usage: " + F.elem("/giveitem <playername> <item name> <amount>")));
UtilPlayer.message(caller, F.main("Item", "Usage: " + F.elem("/giveitem <playername> <amount> <item name>")));
}
}

View File

@ -91,17 +91,6 @@ public class Recharge extends MiniPlugin
}
}
}
/*
public boolean use(Player player, String ability, long recharge, boolean inform)
{
return use(player, ability, ability, recharge, inform, false);
}
public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform)
{
return use(player, ability, ability, recharge, inform, false);
}
*/
public boolean use(Player player, String ability, long recharge, boolean inform, boolean attachItem)
{
@ -150,7 +139,12 @@ public class Recharge extends MiniPlugin
public void useForce(Player player, String ability, long recharge)
{
UseRecharge(player, ability, recharge, false, false);
useForce(player, ability, recharge, false);
}
public void useForce(Player player, String ability, long recharge, boolean attachItem)
{
UseRecharge(player, ability, recharge, attachItem, false);
}
public boolean usable(Player player, String ability)
@ -183,10 +177,8 @@ public class Recharge extends MiniPlugin
RechargeEvent rechargeEvent = new RechargeEvent(player, ability, recharge);
UtilServer.getServer().getPluginManager().callEvent(rechargeEvent);
if (attachItem || attachDurability)
Get(player).put(ability, new RechargeData(this, player, ability, player.getItemInHand(), rechargeEvent.GetRecharge(), attachItem, attachDurability));
else
Get(player).put(ability, new RechargeData(System.currentTimeMillis()+rechargeEvent.GetRecharge()));
Get(player).put(ability, new RechargeData(this, player, ability, player.getItemInHand(),
rechargeEvent.GetRecharge(), attachItem, attachDurability));
}
public void recharge(Player player, String ability)
@ -200,8 +192,36 @@ public class Recharge extends MiniPlugin
_recharge.remove(event.getPlayer().getName());
}
public void setDisplayForce(Player player, String ability, boolean displayForce)
{
if (!_recharge.containsKey(player.getName()))
return;
if (!_recharge.get(player.getName()).containsKey(ability))
return;
_recharge.get(player.getName()).get(ability).DisplayForce = displayForce;
}
public void Reset(Player player)
{
_recharge.put(player.getName(), new NautHashMap<String, RechargeData>());
}
public void debug(Player player, String ability)
{
if (!_recharge.containsKey(player.getName()))
{
player.sendMessage("No Recharge Map.");
return;
}
if (!_recharge.get(player.getName()).containsKey(ability))
{
player.sendMessage("Ability Not Found.");
return;
}
_recharge.get(player.getName()).get(ability).debug(player);
}
}

View File

@ -2,6 +2,7 @@ package mineplex.core.recharge;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -28,14 +29,10 @@ public class RechargeData
public ItemStack Item;
public boolean DisplayForce = false;
public boolean AttachItem;
public boolean AttachDurability;
public RechargeData(long time)
{
Time = time;
}
public RechargeData(Recharge host, Player player, String name, ItemStack stack, long rechargeTime, boolean attachitem, boolean attachDurability)
{
Host = host;
@ -52,16 +49,16 @@ public class RechargeData
public boolean Update()
{
if (Item != null && Name != null && Player != null)
if ((DisplayForce || Item != null) && Name != null && Player != null)
{
//Holding Recharge Item
double percent = (double)(System.currentTimeMillis() - Time)/(double)Recharge;
if (AttachItem)
if (DisplayForce || AttachItem)
{
try
{
if (Player.getItemInHand().getType() == Item.getType())
if (DisplayForce || (Item != null && UtilGear.isMat(Player.getItemInHand(), Item.getType())))
{
if (!UtilTime.elapsed(Time, Recharge))
{
@ -84,27 +81,10 @@ public class RechargeData
}
}
if (AttachDurability)
if (AttachDurability && Item != null)
{
Item.setDurability((short) (Item.getType().getMaxDurability() - (Item.getType().getMaxDurability() * percent)));
}
/*
ItemMeta itemMeta = Item.getItemMeta();
if (System.currentTimeMillis() < Time)
itemMeta.setDisplayName(C.cRed + C.Bold + Name + ChatColor.RESET + " - " + C.cYellow + C.Bold + UtilTime.MakeStr(Time - System.currentTimeMillis()));
else
itemMeta.setDisplayName(C.cGreen + C.Bold + Name);
Item.setItemMeta(itemMeta);
if (System.currentTimeMillis() < Time)
Item.removeEnchantment(Enchantment.DURABILITY);
else
Item.addEnchantment(Enchantment.DURABILITY, 1);
*/
}
@ -115,4 +95,12 @@ public class RechargeData
{
return Recharge - (System.currentTimeMillis() - Time);
}
public void debug(Player player)
{
player.sendMessage("Recharge: " + Recharge);
player.sendMessage("Time: " + Time);
player.sendMessage("Elapsed: " + (System.currentTimeMillis() - Time));
player.sendMessage("Remaining: " + GetRemaining());
}
}

View File

@ -1,5 +1,6 @@
package mineplex.hub;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
@ -13,12 +14,10 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ItemSpawnEvent;
@ -26,8 +25,6 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -54,7 +51,6 @@ 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.UtilEvent;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
@ -69,7 +65,6 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.hologram.ArmorStandHologram;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.mount.MountManager;
@ -93,7 +88,6 @@ import mineplex.hub.modules.MapManager;
import mineplex.hub.modules.NewsManager;
import mineplex.hub.modules.ParkourManager;
import mineplex.hub.modules.TextManager;
import mineplex.hub.modules.TournamentInviter;
import mineplex.hub.modules.UHCManager;
import mineplex.hub.modules.VisibilityManager;
import mineplex.hub.modules.WorldManager;
@ -127,7 +121,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
private TextManager _textCreator;
private ParkourManager _parkour;
private PreferencesManager _preferences;
private InventoryManager _inventoryManager;
private InventoryManager _inventoryManager;
private NewsManager _news;
private AchievementManager _achievementManager;
private TreasureManager _treasureManager;
@ -144,6 +138,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
private boolean _shuttingDown;
private HashMap<String, Long> _portalTime = new HashMap<String, Long>();
private HashMap<String, ArrayList<String>> _creativeAdmin = new HashMap<String, ArrayList<String>>();
//Admin
private boolean _gadgetsEnabled = true;
@ -321,7 +317,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
+ "\n"
+ "\n"
+ " §c§lH§6§lA§a§lV§9§lE §c§lF§6§lU§a§lN§9§l!\n");
// These are needed or 1.8 clients will not show book correctly
meta.setTitle("Rule Book");
meta.setAuthor("Mineplex");
_ruleBook.setItemMeta(meta);
}
@ -999,4 +999,39 @@ public class HubManager extends MiniClientPlugin<HubClient>
if (!_gadgetsEnabled)
event.setCancelled(true);
}
public void addGameMode(Player caller, Player target)
{
if (!_creativeAdmin.containsKey(caller.getName()))
_creativeAdmin.put(caller.getName(), new ArrayList<String>());
if (target.getGameMode() == GameMode.CREATIVE)
{
_creativeAdmin.get(caller.getName()).add(target.getName());
}
else
{
_creativeAdmin.get(caller.getName()).remove(target.getName());
}
}
@EventHandler
public void clearGameMode(PlayerQuitEvent event)
{
ArrayList<String> creative = _creativeAdmin.remove(event.getPlayer().getName());
if (creative == null)
return;
for (String name : creative)
{
Player player = UtilPlayer.searchExact(name);
if (player == null)
continue;
player.setGameMode(GameMode.SURVIVAL);
UtilPlayer.message(player, F.main("Game Mode", event.getPlayer().getName() + " left the game. Creative Mode: " + F.tf(false)));
}
}
}

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.hub.HubManager;
public class GameModeCommand extends CommandBase<HubManager>
@ -17,9 +19,27 @@ public class GameModeCommand extends CommandBase<HubManager>
@Override
public void Execute(Player caller, String[] args)
{
if (caller.getGameMode() == GameMode.SURVIVAL)
caller.setGameMode(GameMode.CREATIVE);
Player target = caller;
if (args != null && args.length >= 1)
{
target = UtilPlayer.searchOnline(caller, args[0], true);
if (target == null)
return;
}
if (target.getGameMode() == GameMode.SURVIVAL)
target.setGameMode(GameMode.CREATIVE);
else
caller.setGameMode(GameMode.SURVIVAL);
target.setGameMode(GameMode.SURVIVAL);
if (!target.equals(caller))
{
Plugin.addGameMode(caller, target);
UtilPlayer.message(target, F.main("Game Mode", caller.getName() + " toggled your Creative Mode: " + F.tf(target.getGameMode() == GameMode.CREATIVE)));
}
UtilPlayer.message(caller, F.main("Game Mode", target.getName() + " Creative Mode: " + F.tf(target.getGameMode() == GameMode.CREATIVE)));
}
}

View File

@ -3,6 +3,7 @@ package mineplex.minecraft.game.classcombat.Skill.Mage;
import java.util.HashMap;
import java.util.HashSet;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -10,6 +11,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
@ -18,6 +20,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -127,7 +130,6 @@ public class ArcticArmor extends Skill
Remove(cur);
continue;
}
//Check Allowed
SkillTriggerEvent trigger = new SkillTriggerEvent(cur, GetName(), GetClassType());
@ -176,6 +178,44 @@ public class ArcticArmor extends Skill
Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, 1, false, true, true);
}
}
@EventHandler
public void Damage(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
for (Player cur : UtilServer.getPlayers())
{
if (cur.getGameMode() != GameMode.SURVIVAL)
continue;
if (cur.getEyeLocation().getBlock().getType() == Material.ICE)
{
Player damager = null;
double closest = 0;
for (Player player : _active)
{
if (player.equals(cur))
continue;
double dist = UtilMath.offset(player, cur);
if (dist < 5 && (damager == null || dist < closest))
{
damager = player;
closest = dist;
}
}
//Damage Event
Factory.Damage().NewDamageEvent(cur, damager, null,
DamageCause.CUSTOM, 2, false, true, false,
damager == null ? null : damager.getName(), "Arctic Ice");
}
}
}
@EventHandler
public void Slow(UpdateEvent event)

View File

@ -70,7 +70,7 @@ public class Fissure extends SkillActive
@Override
public void Skill(Player player, int level)
{
FissureData data = new FissureData(this, player, level, player.getLocation().getDirection(), player.getLocation().add(0, -0.5, 0));
FissureData data = new FissureData(this, player, level, player.getLocation().getDirection(), player.getLocation().add(0, -0.4, 0));
_active.add(data);
//Inform

View File

@ -48,7 +48,7 @@ public class Agility extends SkillActive
"Speed I for #3#1 seconds. You take",
"#45#5 % less damage and take no knockback.",
"",
"Agility ends if you interact."
"Agility ends if you Left-Click."
});
}

View File

@ -61,7 +61,7 @@ public class WolfsPounce extends SkillChargeSword
public void DoSkillCustom(Player player, float charge)
{
//Action
UtilAction.velocity(player, 0.4 + (1.2*charge), 0.2, 0.2 + (0.6*charge), true);
UtilAction.velocity(player, 0.4 + (1.4*charge), 0.2, 0.2 + (0.7*charge), true);
_live.put(player, System.currentTimeMillis());
//Inform

View File

@ -435,7 +435,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Agility(this, "Agility", ClassType.Ranger, SkillType.Axe,
1, 4,
0, 0,
20000, 2000, true,
14000, 1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));

View File

@ -1,5 +1,8 @@
package mineplex.minecraft.game.classcombat.shop.page;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -15,6 +18,7 @@ import mineplex.minecraft.game.classcombat.shop.button.EditAndSaveCustomBuildBut
import mineplex.minecraft.game.classcombat.shop.button.SelectCustomBuildButton;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
@ -85,7 +89,35 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
if (customBuild != null)
{
AddButton(slot, new ShopItem(Material.INK_SACK, itemData, "Apply " + customBuild.Name, lockedText, 1, locked, true), new SelectCustomBuildButton(this, customBuild));
String[] skills = new String[7];
skills[0] = C.cYellow + " ";
skills[1] = C.cYellow + "Sword: " + ChatColor.RESET +
((customBuild.SwordSkillLevel != null && customBuild.SwordSkillLevel > 0) ?
(customBuild.SwordSkill + " " + customBuild.SwordSkillLevel) : "None");
skills[2] = C.cYellow + "Axe: " + ChatColor.RESET +
((customBuild.AxeSkillLevel != null && customBuild.AxeSkillLevel > 0) ?
(customBuild.AxeSkill + " " + customBuild.AxeSkillLevel) : "None");
skills[3] = C.cYellow + "Bow: " + ChatColor.RESET +
((customBuild.BowSkillLevel != null && customBuild.BowSkillLevel > 0) ?
(customBuild.BowSkill + " " + customBuild.BowSkillLevel) : "None");
skills[4] = C.cYellow + "Passive A: " + ChatColor.RESET +
((customBuild.ClassPassiveASkillLevel != null && customBuild.ClassPassiveASkillLevel > 0) ?
(customBuild.ClassPassiveASkill + " " + customBuild.ClassPassiveASkillLevel) : "None");
skills[5] = C.cYellow + "Passive B: " + ChatColor.RESET +
((customBuild.ClassPassiveBSkillLevel != null && customBuild.ClassPassiveBSkillLevel > 0) ?
(customBuild.ClassPassiveBSkill + " " + customBuild.ClassPassiveBSkillLevel) : "None");
skills[6] = C.cYellow + "Passive C: " + ChatColor.RESET +
((customBuild.GlobalPassiveSkillLevel != null && customBuild.GlobalPassiveSkillLevel > 0) ?
(customBuild.GlobalPassiveSkill + " " + customBuild.GlobalPassiveSkillLevel) : "None");
AddButton(slot, new ShopItem(Material.INK_SACK, itemData, "Apply " + customBuild.Name, skills, 1, locked, true), new SelectCustomBuildButton(this, customBuild));
}
else
{

View File

@ -13,6 +13,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Entity;
@ -28,11 +29,13 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
@ -42,6 +45,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
@ -1567,6 +1571,42 @@ public class Bridge extends TeamGame implements OreObsfucation
{
if (!_bridgesDown)
{
if (!event.getToBlock().getRelative(BlockFace.UP).equals(event.getBlock()))
{
event.setCancelled(true);
}
}
}
// @EventHandler
// public void liquidBlockDeny(BlockBreakEvent event)
// {
// if (_bridgesDown)
// return;
//
// if (!IsAlive(event.getPlayer()))
// return;
//
// if (event.getBlock().getRelative(BlockFace.UP).isLiquid() || event.getBlock().getRelative(BlockFace.UP).getRelative(BlockFace.UP).isLiquid())
// {
// UtilPlayer.message(event.getPlayer(), F.main("Game",
// "Cannot tunnel under liquids."));
//
// event.setCancelled(true);
// }
// }
@EventHandler
public void boatDeny(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOAT))
{
UtilPlayer.message(event.getPlayer(), F.main("Game",
"You cannot place boats."));
event.setCancelled(true);
}
}

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.champions;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
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;
@ -20,7 +21,9 @@ 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 ChampionsDominate extends Domination
{
@ -59,6 +62,8 @@ public class ChampionsDominate extends Domination
EloRanking = false;
EloStart = 1000;
this.DisableKillCommand = false;
registerStatTrackers(
new KillReasonStatTracker(this, "Backstab", "Assassination"),
@ -94,4 +99,24 @@ public class ChampionsDominate extends Domination
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();
}
}

View File

@ -2,11 +2,14 @@ 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.UtilPlayer;
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;
@ -58,6 +61,8 @@ public class ChampionsTDM extends TeamDeathmatch
InventoryOpenChest = true;
this.DisableKillCommand = false;
registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this),
@ -94,4 +99,24 @@ public class ChampionsTDM extends TeamDeathmatch
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();
}
}

View File

@ -22,6 +22,7 @@ import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
public class CapturePoint
@ -43,9 +44,9 @@ public class CapturePoint
private boolean _captured = false;
private ArrayList<Block> _captureFloor = new ArrayList<Block>();
private long _decayDelay = 0;
private int _indicatorTick = 0;
private ChatColor _scoreboardColor = ChatColor.WHITE;
private int _scoreboardTick = 0;
@ -82,14 +83,14 @@ public class CapturePoint
block.setType(Material.BEACON);
}
}
//Glass
if (Math.abs(x) <= 2 && Math.abs(z) <= 2)
{
Block block = loc.getBlock().getRelative(x, -1, z);
block.setType(Material.GLASS);
block.setType(Material.STAINED_GLASS);
}
//Iron
if (Math.abs(x) <= 1 && Math.abs(z) <= 1)
{
@ -132,7 +133,7 @@ public class CapturePoint
{
if (player.getGameMode() != GameMode.SURVIVAL)
continue;
if (Math.abs(_loc.getX() - player.getLocation().getX()) > 2.5)
continue;
@ -163,7 +164,6 @@ public class CapturePoint
return;
}
//Capture
if (teamB == null)
@ -180,7 +180,7 @@ public class CapturePoint
{
if (!UtilTime.elapsed(_decayDelay, 2000))
return;
//Degen
if (!_captured)
{
@ -193,13 +193,12 @@ public class CapturePoint
_floor.add(block);
block.setData((byte)0);
setWoolColor(block, null, false);
}
//Set Uncaptured
if (_captureAmount == 0)
{
_captured = false;
_owner = null;
//Indicators
@ -208,7 +207,7 @@ public class CapturePoint
block.setData((byte)0);
}
}
//Effect
for (Block block : _indicators)
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 35);
@ -225,10 +224,9 @@ public class CapturePoint
_captureFloor.add(block);
if (_owner.GetColor() == ChatColor.RED) block.setData((byte)14);
else block.setData((byte)11);
setWoolColor(block, _owner.GetColor(), false);
}
//Effect
for (Block block : _indicators)
{
@ -237,21 +235,21 @@ public class CapturePoint
else
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 22);
}
}
}
public void Capture(GameTeam team, int count, Collection<Player> capturers)
{
_scoreboardColor = team.GetColor();
//Decay Delay
_decayDelay = System.currentTimeMillis();
//Defend Score
//if (_captured)
// Host.AddScore(_owner, count);
//Color
Color color = Color.RED;
if (team.GetColor() == ChatColor.BLUE)
@ -264,7 +262,7 @@ public class CapturePoint
int bonus = 0;
if (_captured)
bonus = 1;
_captureAmount = Math.min(_captureMax, (_captureAmount + ((_captureRate*count)+bonus)));
//Floor Color
@ -274,8 +272,7 @@ public class CapturePoint
_captureFloor.add(block);
if (team.GetColor() == ChatColor.RED) block.setData((byte)14);
else block.setData((byte)11);
setWoolColor(block, team.GetColor(), false);
}
//Set Fully Captured
@ -284,7 +281,6 @@ public class CapturePoint
_captured = true;
//Firework
Firework(_loc, color, true);
//Indicators
@ -293,7 +289,10 @@ public class CapturePoint
if (team.GetColor() == ChatColor.RED) block.setData((byte)14);
else block.setData((byte)11);
}
//Center
setWoolColor(_loc.getBlock().getRelative(0, -2, 0), _owner.GetColor(), true);
//Reward Gems
if (capturers != null)
{
@ -311,7 +310,7 @@ public class CapturePoint
int bonus = 0;
if (!_captured)
bonus = 1;
_captureAmount = Math.max(0, (_captureAmount - ((_captureRate*count)+bonus)));
//Announce
@ -323,7 +322,7 @@ public class CapturePoint
player.playSound(player.getLocation(), Sound.GHAST_SCREAM2, 0.6f, 0.6f);
}
}
//Floor Color
while ((double)_captureFloor.size()/((double)_captureFloor.size() + (double)_floor.size()) > _captureAmount/_captureMax)
{
@ -331,7 +330,7 @@ public class CapturePoint
_floor.add(block);
block.setData((byte)0);
setWoolColor(block, null, false);
}
//Set Uncaptured
@ -339,6 +338,9 @@ public class CapturePoint
{
_captured = false;
_owner = team;
//Center
setWoolColor(_loc.getBlock().getRelative(0, -2, 0), null, true);
//Indicators
for (Block block : _indicators)
@ -358,10 +360,32 @@ public class CapturePoint
RewardCapture(player, 1);
}
}
Indicate(color);
}
}
private void setWoolColor(Block block, ChatColor color, boolean glassOnly)
{
if (color == null)
{
if (!glassOnly)
block.setData((byte)0);
block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)0, true);
}
else if (color == ChatColor.RED)
{
if (!glassOnly)
block.setData((byte)14);
block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)14, true);
}
else
{
if (!glassOnly)
block.setData((byte)11);
block.getRelative(BlockFace.UP).setTypeIdAndData(95, (byte)11, true);
}
}
public void Firework(Location loc, Color color, boolean major)
@ -380,24 +404,24 @@ public class CapturePoint
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 152);
else
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 22);
//for (Block block : _indicators)
//Firework(_indicators.get(_indicatorTick).getLocation().add(0.5, 0.5, 0.5), color, false);
_indicatorTick = (_indicatorTick + 1)%_indicators.size();
}
public String GetScoreboardName()
{
_scoreboardTick = (_scoreboardTick + 1)%2;
String out = "";
if (_scoreboardColor != null && _scoreboardTick == 0)
{
if (_scoreboardColor == ChatColor.BLUE)
_scoreboardColor = ChatColor.AQUA;
out = _scoreboardColor + C.Bold + _name;
_scoreboardColor = null;
}
@ -410,17 +434,17 @@ public class CapturePoint
else
out = _owner.GetColor() + _name;
}
else
out = _name;
}
if (out.length() > 16)
out = out.substring(0, 16);
return out;
}
public void RewardCapture(Player player, int amount)
{
Host.AddGems(player, amount / 25d, "Control Point Score", true);

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.dragonescape;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
@ -35,12 +36,14 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.data.BlockData;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -93,6 +96,8 @@ public class DragonEscape extends SoloGame
private Player _winner = null;
private double _speedMult = 1;
private HashMap<BlockData, Player> _tunneled = new HashMap<BlockData, Player>();
public DragonEscape(ArcadeManager manager)
{
@ -103,7 +108,7 @@ public class DragonEscape extends SoloGame
new KitLeaper(manager),
new KitDisruptor(manager),
new KitWarper(manager),
new KitTunneler(manager),
new KitDigger(manager),
},
new String[]
@ -553,6 +558,12 @@ public class DragonEscape extends SoloGame
if (!player.getInventory().contains(Material.DIAMOND_PICKAXE))
return;
if (!UtilTime.elapsed(GetStateTime(), 10000))
{
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(6000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
return;
}
if (!Recharge.Instance.use(player, "Tunneler", 100, false, false))
return;
@ -560,8 +571,10 @@ public class DragonEscape extends SoloGame
player.getInventory().addItem(new ItemStack(event.getBlock().getType()));
Manager.GetBlockRestore().Add(event.getBlock(), 0, (byte)0, 3000);
_tunneled.put(new BlockData(event.getBlock()), player);
Manager.GetBlockRestore().Add(event.getBlock(), 0, (byte)0, 2400);
UtilInv.remove(player, Material.DIAMOND_PICKAXE, (byte)0, 1);
}
@ -570,9 +583,31 @@ public class DragonEscape extends SoloGame
{
if (event.isCancelled())
return;
Manager.GetBlockRestore().Add(event.getBlock(),
event.getPlayer().getItemInHand().getType().getId(), event.getPlayer().getItemInHand().getData().getData(),
event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 3000);
event.getBlockReplacedState().getTypeId(), event.getBlockReplacedState().getRawData(), 2400);
}
@EventHandler
public void TunnelerUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<BlockData> tunnelIterator = _tunneled.keySet().iterator();
while (tunnelIterator.hasNext())
{
BlockData data = tunnelIterator.next();
if (data.Block.getType() != Material.AIR || UtilTime.elapsed(data.Time, 2400))
tunnelIterator.remove();
else
for (Player other : UtilServer.getPlayers())
if (!other.equals(_tunneled.get(data)))
other.sendBlockChange(data.Block.getLocation(), data.Material, data.Data);
}
}
}

View File

@ -12,9 +12,9 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitTunneler extends Kit
public class KitDigger extends Kit
{
public KitTunneler(ArcadeManager manager)
public KitDigger(ArcadeManager manager)
{
super(manager, "Digger", KitAvailability.Achievement, 5000,

View File

@ -1,9 +1,11 @@
package nautilus.game.arcade.game.games.draw;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -16,6 +18,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -25,6 +28,8 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
@ -43,8 +48,10 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.GameScore;
import nautilus.game.arcade.game.games.draw.kits.KitPlayer;
import nautilus.game.arcade.game.games.draw.kits.*;
import nautilus.game.arcade.game.games.draw.tools.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KeenEyeStatTracker;
import nautilus.game.arcade.stats.MrSquiggleStatTracker;
@ -76,6 +83,7 @@ public class Draw extends SoloGame
private Collection<Block> _textBlocks = null;
private HashSet<Tool> _tools;
private String[] _words;
private HashSet<String> _usedWords = new HashSet<String>();
@ -85,7 +93,9 @@ public class Draw extends SoloGame
new Kit[]
{
new KitPlayer(manager),
new KitSlowAndSteady(manager),
new KitSelector(manager),
new KitTools(manager),
},
new String[]
@ -104,6 +114,11 @@ public class Draw extends SoloGame
{
"Bird", "Volcano", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Crack", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin",
};
_tools = new HashSet<Tool>();
_tools.add(new ToolLine(this));
_tools.add(new ToolSquare(this));
_tools.add(new ToolCircle(this));
registerStatTrackers(
new MrSquiggleStatTracker(this),
@ -192,6 +207,10 @@ public class Draw extends SoloGame
if (event.getType() != UpdateType.FAST)
return;
//Word Selection
if (_round != null && !_round.ChooseWordUpdate())
return;
//End Round
if (_round != null && (_round.IsDone() || _drawers.GetPlayers(true).isEmpty() || _round.AllGuessed(_guessers.GetPlayers(true))))
@ -223,6 +242,7 @@ public class Draw extends SoloGame
EndCheck();
}
//Reset Round
if ((_round == null && UtilTime.elapsed(_roundTime, 5000) && !_roundPlayer.isEmpty()))
{
Reset();
@ -232,13 +252,8 @@ public class Draw extends SoloGame
_guessers.RemovePlayer(drawer);
_drawers.AddPlayer(drawer, true);
//Get Word
String word = _words[UtilMath.r(_words.length)];
while (!_usedWords.add(word))
word = _words[UtilMath.r(_words.length)];
//Create Round
_round = new DrawRound(this, drawer, word);
_round = new DrawRound(this, drawer);
//Prep Drawer
drawer.teleport(_drawerLocation);
@ -249,15 +264,31 @@ public class Draw extends SoloGame
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte)0, 1, "Thin Paint Brush"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Thick Paint Brush"));
if (GetKit(drawer) instanceof KitTools)
{
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD, (byte)0, 1, "Line Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Square Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Circle Tool"));
}
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET, (byte)0, 1, "Paint Bucket"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, "Clear Canvas"));
Announce(C.cGold + C.Bold + "Round " + (_roundCount+1) + ": " + C.cYellow + C.Bold + drawer.getName() + " is drawing!");
UtilPlayer.message(drawer, C.cWhite + C.Bold + "You must draw: " + C.cGreen + C.Bold + _round.Word);
}
}
public String GetWord()
{
//Get Word
String word = _words[UtilMath.r(_words.length)];
while (!_usedWords.add(word))
word = _words[UtilMath.r(_words.length)];
return word;
}
@EventHandler(priority = EventPriority.LOWEST)
public void Guess(AsyncPlayerChatEvent event)
{
@ -267,6 +298,9 @@ public class Draw extends SoloGame
if (_round == null)
return;
if (!_round.IsReady())
return;
Player player = event.getPlayer();
if (event.getMessage().toLowerCase().contains(_round.Word.toLowerCase()))
@ -317,16 +351,22 @@ public class Draw extends SoloGame
if (_round == null)
return;
if (!_round.IsReady())
{
UtilTextBottom.displayProgress(C.Bold + "Word Selection", _round.GetTimePercent(), _round.GetTimeString(), UtilServer.getPlayers());
return;
}
for (Player player : UtilServer.getPlayers())
{
if (_drawers.HasPlayer(player))
{
UtilTextBottom.displayProgress(C.Bold + "Draw " + _round.Word, _round.GetTimePercent(), player);
UtilTextBottom.displayProgress(C.cYellow + C.Bold + "Draw: " + ChatColor.RESET + _round.Word, _round.GetTimePercent(), _round.GetTimeString(), player);
}
else
{
UtilTextBottom.displayProgress(C.cYellow + C.Bold + "Clue " + ChatColor.RESET + C.Bold + _round.GetRevealedWord(), _round.GetTimePercent(), player);
UtilTextBottom.display(_round.GetRevealedWord() + C.cYellow + C.Bold + " HINT " + ChatColor.RESET + _round.GetTimeString(), player);
}
}
}
@ -357,6 +397,29 @@ public class Draw extends SoloGame
}
}
@EventHandler
public void toolStart(PlayerInteractEvent event)
{
if (!IsLive())
return;
for (Tool tool : _tools)
tool.start(event);
}
@EventHandler
public void toolUpdate(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.TICK)
return;
for (Tool tool : _tools)
tool.update();
}
@EventHandler
public void Paint(UpdateEvent event)
{
@ -368,6 +431,9 @@ public class Draw extends SoloGame
for (Player player : _drawers.GetPlayers(true))
{
if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD) && !UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
continue;
if (!player.isBlocking())
{
_brushPrevious = null;
@ -432,7 +498,6 @@ public class Draw extends SoloGame
_brushPrevious = block.getLocation().add(0.5, 0.5, 0.5);
}
}
@EventHandler
public void PaintReset(PlayerInteractEvent event)
@ -581,6 +646,40 @@ public class Draw extends SoloGame
}
}
}
@Override
public List<Player> getWinners()
{
if (GetState().ordinal() >= GameState.End.ordinal())
{
SortScores();
//Set Places
ArrayList<Player> places = new ArrayList<Player>();
for (int i=0 ; i<_ranks.size() ; i++)
places.add(i, _ranks.get(i).Player);
if (places.isEmpty() || !places.get(0).isOnline())
return Arrays.asList();
else
return Arrays.asList(places.get(0));
}
else
return null;
}
@Override
public List<Player> getLosers()
{
List<Player> losers = getWinners();
if (losers == null)
return null;
losers.remove(0);
return losers;
}
@Override
public void EndCheck()
@ -653,4 +752,44 @@ public class Draw extends SoloGame
Scoreboard.Draw();
}
@EventHandler
public void selectionInput(PlayerCommandPreprocessEvent event)
{
if (!event.getMessage().startsWith("/selectword "))
return;
event.setCancelled(true);
if (_round == null)
return;
if (!_round.Drawer.equals(event.getPlayer()))
return;
if (event.getMessage().length() <= 12)
return;
_round.WordClicked(event.getMessage().substring(12));
}
public ArrayList<Block> getCanvas()
{
return _canvas;
}
public boolean isDrawer(Player player)
{
return _drawers.HasPlayer(player);
}
public byte getColor()
{
return _brushColor;
}
public void setLock(boolean b)
{
_lockDrawer = b;
}
}

View File

@ -3,13 +3,23 @@ package nautilus.game.arcade.game.games.draw;
import java.util.ArrayList;
import java.util.HashSet;
import nautilus.game.arcade.game.games.draw.kits.KitSelector;
import nautilus.game.arcade.game.games.draw.kits.KitSlowAndSteady;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.common.jsonchat.ChildJsonMessage;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
public class DrawRound
@ -21,22 +31,70 @@ public class DrawRound
public int Revealed = 0;
public boolean[] WordReveal;
public long Time;
public double TimeMax = 50;
public double TimeMax;
public double TimeChooseMax = 10;
public HashSet<String> Guessed = new HashSet<String>();
public ArrayList<String> WordChoices;
public DrawRound(Draw draw, Player player, String word)
public DrawRound(Draw draw, Player player)
{
Host = draw;
Drawer = player;
Word = word;
Time = System.currentTimeMillis();
//Kit Modification
Kit kit = draw.GetKit(player);
//Time
if (kit != null && kit instanceof KitSlowAndSteady)
TimeMax = 60;
else
TimeMax = 50;
//Word
if (kit != null && kit instanceof KitSelector)
{
WordChoices = new ArrayList<String>();
while (WordChoices.size() < 3)
WordChoices.add(draw.GetWord());
//Inform
UtilTextMiddle.display("Select Your Word", "Click on a word in Chat", 20, 60, 10, player);
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cGreen + C.Bold + "Select Your Word");
for (int i=0 ; i<WordChoices.size() ; i++)
{
ChildJsonMessage message = new JsonMessage("").color("white").extra("").color("white");
message.add("Option " + i + ": ").color("yellow");
message.add(WordChoices.get(i)).color("white").bold().click("run_command", "/selectword " + WordChoices.get(i)).hover("show_text", "Select " + WordChoices.get(i));
message.sendToPlayer(player);
}
Word = null;
}
else
{
SetWord(draw.GetWord());
}
}
public void SetWord(String word)
{
Word = word;
WordReveal = new boolean[word.length()];
for (int i=0 ; i< WordReveal.length ; i++)
WordReveal[i] = false;
Time = System.currentTimeMillis();
UtilPlayer.message(Drawer, C.cWhite + C.Bold + "You must draw: " + C.cGreen + C.Bold + Word);
}
public boolean Guessed(Player player)
{
if (Guessed.add(player.getName()))
@ -115,7 +173,18 @@ public class DrawRound
public double GetTimePercent()
{
return (TimeMax - (double)(System.currentTimeMillis()-Time)/1000d)/45d;
if (!IsReady())
return (TimeChooseMax - (double)(System.currentTimeMillis()-Time)/1000d)/TimeChooseMax;
return (TimeMax - (double)(System.currentTimeMillis()-Time)/1000d)/TimeMax;
}
public String GetTimeString()
{
if (!IsReady())
return UtilTime.MakeStr((long)(TimeChooseMax*1000 - (double)(System.currentTimeMillis()-Time)));
return UtilTime.MakeStr((long)(TimeMax*1000 - (double)(System.currentTimeMillis()-Time)));
}
public boolean AllGuessed(ArrayList<Player> players)
@ -131,4 +200,37 @@ public class DrawRound
{
return Drawer;
}
public boolean ChooseWordUpdate()
{
if (Word == null && UtilTime.elapsed(Time, (long)(TimeChooseMax*1000)))
{
if (WordChoices.isEmpty())
{
SetWord(Host.GetWord());
}
else
{
SetWord(UtilAlg.Random(WordChoices));
}
}
return IsReady();
}
public boolean IsReady()
{
return Word != null;
}
public void WordClicked(String string)
{
if (IsReady())
return;
if (WordChoices.contains(string))
{
SetWord(string);
}
}
}

View File

@ -8,15 +8,15 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
public class KitPlayer extends Kit
public class KitSelector extends Kit
{
public KitPlayer(ArcadeManager manager)
public KitSelector(ArcadeManager manager)
{
super(manager, "Player", KitAvailability.Free,
super(manager, "Selector", KitAvailability.Gem, 4000,
new String[]
{
""
"Choose from one of three words to draw!"
},
new Perk[]

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.draw.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
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 KitSlowAndSteady extends Kit
{
public KitSlowAndSteady(ArcadeManager manager)
{
super(manager, "Extra Time", KitAvailability.Free,
new String[]
{
"Receive +10 Seconds to draw!"
},
new Perk[]
{
},
EntityType.SKELETON,
new ItemStack(Material.WATCH));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,44 @@
package nautilus.game.arcade.game.games.draw.kits;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import mineplex.core.achievement.Achievement;
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 KitTools extends Kit
{
public KitTools(ArcadeManager manager)
{
super(manager, "Extra Tools", KitAvailability.Achievement,
new String[]
{
"Can draw lines, circles and squares!"
},
new Perk[]
{
},
EntityType.SKELETON,
null);
this.setAchievementRequirements(new Achievement[]
{
Achievement.DRAW_MY_THING_KEEN_EYE,
Achievement.DRAW_MY_THING_MR_SQUIGGLE,
Achievement.DRAW_MY_THING_PURE_LUCK,
Achievement.DRAW_MY_THING_WINS,
});
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -0,0 +1,94 @@
package nautilus.game.arcade.game.games.draw.tools;
import java.util.HashMap;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEvent;
public abstract class Tool
{
protected Draw Host;
protected Player _drawer;
protected Block _start;
protected Material _material;
protected HashMap<Block, Byte> _past = new HashMap<Block, Byte>();
protected HashMap<Block, Byte> _new = new HashMap<Block, Byte>();
public Tool(Draw host, Material mat)
{
Host = host;
_material = mat;
}
public void start(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
Block block = event.getPlayer().getTargetBlock(null, 60);
if (block == null)
return;
if (!Host.getCanvas().contains(block))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), _material))
return;
_drawer = event.getPlayer();
_start = block;
Host.setLock(false);
}
public void update()
{
if (_start == null || _drawer == null)
return;
if (!_drawer.isOnline() || !Host.isDrawer(_drawer) || !_drawer.isBlocking())
{
_drawer = null;
_start = null;
_past.clear();
return;
}
_new = new HashMap<Block, Byte>();
//Calculate New
Block end = _drawer.getTargetBlock(null, 64);
if (end != null && Host.getCanvas().contains(end))
{
customDraw(end);
}
//Remove Old
for (Block block : _past.keySet())
{
if (!_new.containsKey(block))
block.setData(_past.get(block));
}
_past = _new;
_new = null;
for (Player other : UtilServer.getPlayers())
other.playSound(other.getLocation(), Sound.FIZZ, 0.2f, 2f);
}
public abstract void customDraw(Block end);
}

View File

@ -0,0 +1,57 @@
package nautilus.game.arcade.game.games.draw.tools;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class ToolCircle extends Tool
{
public ToolCircle(Draw host)
{
super(host, Material.DIAMOND_SWORD);
}
public void customDraw(Block end)
{
Location mid = UtilAlg.getMidpoint(_start.getLocation().add(0.5, 0.5, 0.5), end.getLocation().add(0.5, 0.5, 0.5));
double height = Math.max(_start.getY(), end.getY()) - mid.getY();
boolean planeIsZ = _start.getZ() == end.getZ();
double width = Math.max(_start.getX(), end.getX()) - mid.getX();
if (!planeIsZ)
width = Math.max(_start.getZ(), end.getZ()) - mid.getZ();
for (double i=0 ; i<Math.PI*2 ; i += 0.05)
{
double horizontal = Math.sin(i) * width;
double vertical = Math.cos(i) * height + 0.4;
color(mid.clone().add(planeIsZ ? horizontal : 0, vertical, planeIsZ ? 0 : horizontal));
}
}
public void color(Location loc)
{
Block block = loc.getBlock();
if (_new.containsKey(block))
return;
if (!Host.getCanvas().contains(block))
return;
byte color = block.getData();
if (_past.containsKey(block))
color = _past.get(block);
_new.put(block, color);
block.setData(Host.getColor());
}
}

View File

@ -0,0 +1,42 @@
package nautilus.game.arcade.game.games.draw.tools;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class ToolLine extends Tool
{
public ToolLine(Draw host)
{
super(host, Material.STONE_SWORD);
}
public void customDraw(Block end)
{
Location loc = _start.getLocation().add(0.5, 0.5, 0.5);
while (UtilMath.offset(loc, end.getLocation().add(0.5, 0.5, 0.5)) > 0.5)
{
loc.add(UtilAlg.getTrajectory(loc, end.getLocation().add(0.5, 0.5, 0.5)).multiply(0.5));
Block lineBlock = loc.getBlock();
if (_new.containsKey(lineBlock))
continue;
if (!Host.getCanvas().contains(lineBlock))
continue;
byte color = lineBlock.getData();
if (_past.containsKey(lineBlock))
color = _past.get(lineBlock);
_new.put(lineBlock, color);
lineBlock.setData(Host.getColor());
}
}
}

View File

@ -0,0 +1,82 @@
package nautilus.game.arcade.game.games.draw.tools;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class ToolSquare extends Tool
{
public ToolSquare(Draw host)
{
super(host, Material.GOLD_SWORD);
}
public void customDraw(Block end)
{
Location upper = new Location(end.getWorld(), Math.max(_start.getX(), end.getX()), Math.max(_start.getY(), end.getY()), Math.max(_start.getZ(), end.getZ()));
upper.add(0.5, 0.5, 0.5);
Location lower = new Location(end.getWorld(), Math.min(_start.getX(), end.getX()), Math.min(_start.getY(), end.getY()), Math.min(_start.getZ(), end.getZ()));
lower.add(0.5, 0.5, 0.5);
Location cur = upper.clone();
//Decrease
while (cur.getX() > lower.getX())
{
cur.setX(cur.getX() - 1);
color(cur);
}
while (cur.getY() > lower.getY())
{
cur.setY(cur.getY() - 1);
color(cur);
}
while (cur.getZ() > lower.getZ())
{
cur.setZ(cur.getZ() - 1);
color(cur);
}
//Increase
while (cur.getX() < upper.getX())
{
cur.setX(cur.getX() + 1);
color(cur);
}
while (cur.getY() < upper.getY())
{
cur.setY(cur.getY() + 1);
color(cur);
}
while (cur.getZ() < upper.getZ())
{
cur.setZ(cur.getZ() + 1);
color(cur);
}
}
public void color(Location loc)
{
Block block = loc.getBlock();
if (_new.containsKey(block))
return;
if (!Host.getCanvas().contains(block))
return;
byte color = block.getData();
if (_past.containsKey(block))
color = _past.get(block);
_new.put(block, color);
block.setData(Host.getColor());
}
}

View File

@ -25,6 +25,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -53,7 +54,8 @@ public class Quiver extends SoloGame
{
new KitLeaper(manager),
new KitBrawler(manager),
new KitElementalist(manager),
new KitEnchanter(manager),
new KitSlamShot(manager)
},
new String[]
@ -148,8 +150,18 @@ public class Quiver extends SoloGame
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null) return;
int amount = 1;
if (GetKit(player) instanceof KitSlamShot)
{
if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(), ConditionType.FALLING, null))
{
amount = 2;
}
}
//New Arrow
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, amount, F.item("Super Arrow")));
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
//Score

View File

@ -16,9 +16,9 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitElementalist extends Kit
public class KitEnchanter extends Kit
{
public KitElementalist(ArcadeManager manager)
public KitEnchanter(ArcadeManager manager)
{
super(manager, "Enchanter", KitAvailability.Gem, 5000,

View File

@ -29,7 +29,7 @@ public class KitLeaper extends Kit
new Perk[]
{
new PerkDoubleJump("Double Jump", 0.9, 0.9, true)
new PerkSeismicSlam()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));
@ -39,7 +39,7 @@ public class KitLeaper extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live)

View File

@ -0,0 +1,68 @@
package nautilus.game.arcade.game.games.quiver.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitSlamShot extends Kit
{
public KitSlamShot(ArcadeManager manager)
{
super(manager, "Slam Shooter", KitAvailability.Achievement,
new String[]
{
"Gets 2 arrows for killing slammed players!"
},
new Perk[]
{
new PerkSeismicSlamOITQ()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SPADE));
this.setAchievementRequirements(new Achievement[]
{
Achievement.OITQ_PERFECTIONIST,
Achievement.OITQ_SHARPSHOOTER,
Achievement.OITQ_WHATS_A_BOW,
Achievement.OITQ_WINS,
});
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
}
}
}

View File

@ -36,6 +36,7 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime;
@ -140,8 +141,6 @@ public class SheepGame extends TeamGame
"Most sheep at 5 minutes wins!"
});
this.StrictAntiHack = true;
this.DeathOut = false;
this.DeathSpectateSecs = 8;
@ -233,35 +232,66 @@ public class SheepGame extends TeamGame
UtilFirework.playFirework(sheep.getLocation().add(0, 0.5, 0), FireworkEffect.builder().flicker(false).withColor(Color.WHITE).with(Type.BALL).trail(false).build());
}
// @EventHandler
// public void Stack(PlayerInteractEntityEvent event)
// {
// if (!IsLive())
// return;
//
// if (!(event.getRightClicked() instanceof Sheep))
// return;
//
// if (event.getRightClicked().getVehicle() != null)
// return;
//
// if (!Recharge.Instance.usable(event.getPlayer(), "Sheep Stack", true))
// return;
//
// SheepStack(event.getPlayer(), (Sheep)event.getRightClicked());
// }
@EventHandler
public void Stack(PlayerInteractEntityEvent event)
public void Stack(UpdateEvent event)
{
if (!IsLive())
if (event.getType() != UpdateType.TICK)
return;
if (!(event.getRightClicked() instanceof Sheep))
return;
if (event.getRightClicked().getVehicle() != null)
return;
Player player = event.getPlayer();
if (!Recharge.Instance.usable(player, "Sheep Stack"))
return;
for (Player player : GetPlayers(true))
{
if (!Recharge.Instance.usable(player, "Sheep Stack"))
return;
for (Entity ent : player.getWorld().getEntities())
{
if (!(ent instanceof Sheep))
continue;
if (ent.getVehicle() != null)
continue;
if (UtilMath.offset(player, ent) > 2.5)
continue;
if (SheepStack(player, (Sheep)ent))
break;
}
}
}
public boolean SheepStack(Player player, Sheep sheep)
{
if (player.getItemInHand() != null && player.getItemInHand().getType() != Material.SADDLE)
return;
return true;
if (event.getPlayer().getGameMode() != GameMode.SURVIVAL)
return;
if (player.getGameMode() != GameMode.SURVIVAL)
return true;
if (!IsAlive(event.getPlayer()))
return;
if (!IsAlive(player))
return true;
if (player.getPassenger() != null && player.getPassenger() instanceof Player)
{
DropSheep(player);
DropSheep(player, 500);
}
//Holding too many
@ -275,36 +305,41 @@ public class SheepGame extends TeamGame
if (count >= 3)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot hold more than 3 Sheep!"));
return;
//UtilPlayer.message(player, F.main("Game", "You cannot hold more than 3 Sheep!"));
return true;
}
for (SheepData data : _sheep.values())
{
if (data.Sheep.equals(event.getRightClicked()))
if (data.Sheep.equals(sheep))
{
if (data.Owner != null && data.Owner.equals(GetTeam(event.getPlayer())) && data.IsInsideOwnPen())
if (data.Owner != null && data.Owner.equals(GetTeam(player)) && data.IsInsideOwnPen())
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You have already captured this Sheep!"));
return;
//UtilPlayer.message(player, F.main("Game", "You have already captured this Sheep!"));
return false;
}
data.SetHolder(event.getPlayer());
data.SetHolder(player);
}
}
//Put Wool in Inventory
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)event.getRightClicked()).getColor().getWoolData()));
player.getInventory().setItem(4 + count, ItemStackFactory.Instance.CreateStack(35, ((Sheep)sheep).getColor().getWoolData()));
UtilInv.Update(player);
//Effect
event.getRightClicked().getWorld().playEffect(event.getRightClicked().getLocation(), Effect.STEP_SOUND, 35);
sheep.getWorld().playEffect(sheep.getLocation(), Effect.STEP_SOUND, 35);
//Stack
top.setPassenger(event.getRightClicked());
top.setPassenger(sheep);
//Audio
player.playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 3f);
//Cooldown
Recharge.Instance.useForce(player, "Sheep Stack", 500);
return true;
}
@EventHandler
@ -329,7 +364,7 @@ public class SheepGame extends TeamGame
return;
if (player.getPassenger() != null)
DropSheep(player);
DropSheep(player, 500);
if (!Recharge.Instance.usable(player, "Sheep Stack"))
return;
@ -350,22 +385,25 @@ public class SheepGame extends TeamGame
player.setPassenger(other);
//Audio
player.playSound(player.getLocation(), Sound.VILLAGER_YES, 2f, 3f);
other.playSound(player.getLocation(), Sound.VILLAGER_NO, 2f, 3f);
player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f);
//Inform
UtilPlayer.message(other, F.main("Skill", F.elem(GetTeam(player).GetColor() + player.getName()) + " picked you up."));
UtilPlayer.message(player, F.main("Skill", "You picked up " + F.elem(GetTeam(player).GetColor() + player.getName()) + "."));
UtilPlayer.message(player, F.main("Skill", "You picked up " + F.elem(GetTeam(other).GetColor() + other.getName()) + "."));
}
@EventHandler
public void DeathDrop(PlayerDeathEvent event)
{
DropSheep(event.getEntity());
DropSheep(event.getEntity(), 0);
}
public void DropSheep(Player player)
public void DropSheep(Player player, long cooldown)
{
//Brute can only throw
if (GetKit(player) instanceof KitBrute)
return;
boolean hadSheep = false;
Entity top = player;
@ -388,12 +426,15 @@ public class SheepGame extends TeamGame
//Audio
player.playSound(player.getLocation(), Sound.SHEEP_IDLE, 2f, 1f);
//Recharge
Recharge.Instance.useForce(player, "Sheep Stack", cooldown);
}
@EventHandler
public void Drop(PlayerDropItemEvent event)
{
DropSheep(event.getPlayer());
DropSheep(event.getPlayer(), 500);
}
@EventHandler
@ -452,9 +493,24 @@ public class SheepGame extends TeamGame
UtilTextTop.displayProgress(C.Bold + "Return the Sheep to your Team Pen!", (float)count/3f, player);
}
}
@EventHandler(priority = EventPriority.LOW)
public void DamageSheepCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetDamagerPlayer(true) != null)
{
if (event.GetDamagerPlayer(true).getPassenger() != null)
{
event.SetCancelled("SQ: Has Passenger");
}
}
}
@EventHandler(priority = EventPriority.LOW)
public void DamagePasson(CustomDamageEvent event)
public void DamagePassOn(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
@ -493,7 +549,7 @@ public class SheepGame extends TeamGame
Player player = event.GetDamageePlayer();
if (player == null) return;
DropSheep(player);
DropSheep(player, 2000);
Bukkit.getPluginManager().callEvent(new DropEnemySheepEvent(event.GetDamagerPlayer(true), player));
}

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemStackFactory;
@ -45,7 +46,8 @@ public class KitArcher extends Kit
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte)0, 1,
C.cYellow + C.Bold + "Move Near Sheep" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Pick Up Sheep"));
}
@Override

View File

@ -5,8 +5,8 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
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.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
@ -27,7 +27,7 @@ public class KitBeserker extends Kit
new Perk[]
{
new PerkLeap("Beserker Leap", 1.2, 1.2, 8000)
new PerkDoubleJump("Beserker Jump", 1.2, 1.2, true, 8000, true)
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_AXE));
@ -37,7 +37,8 @@ public class KitBeserker extends Kit
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte)0, 1,
C.cYellow + C.Bold + "Move Near Sheep" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Pick Up Sheep"));
}
@Override

View File

@ -38,7 +38,8 @@ public class KitBrute extends Kit
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.SADDLE, (byte)0, 1,
C.cYellow + C.Bold + "Move Near Sheep" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Pick Up Sheep"));
}
@Override

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -36,7 +37,7 @@ public class KitSkeleton extends SmashKit
{
new PerkSmashStats(5, 1.25, 0.20, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkFletcher(2, 1, false),
new PerkFletcher(2, 4, false),
new PerkKnockbackArrow(1.75),
new PerkBoneExplosion(),
new PerkRopedArrow("Roped Arrow", 1, 5000),
@ -56,7 +57,7 @@ public class KitSkeleton extends SmashKit
ChatColor.RESET + "Releases an explosion of bones from",
ChatColor.RESET + "your body, repelling all nearby enemies.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1,
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Roped Arrow",
new String[]
@ -67,7 +68,7 @@ public class KitSkeleton extends SmashKit
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, 1,
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1,
C.cYellow + C.Bold + "Charge Bow" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Barrage",
new String[]
{

View File

@ -1,7 +1,9 @@
package nautilus.game.arcade.game.games.sneakyassassins;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.*;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.*;
import mineplex.core.updater.event.*;
import mineplex.minecraft.game.core.combat.event.*;
@ -54,7 +56,8 @@ public class SneakyAssassins extends SoloGame
new Kit[]{
new KitEscapeArtist(manager, EntityType.VILLAGER),
new KitAssassin(manager, EntityType.VILLAGER),
new KitRevealer(manager, EntityType.VILLAGER)
new KitRevealer(manager, EntityType.VILLAGER),
new KitBriber(manager, EntityType.VILLAGER),
},
new String[]
{
@ -286,7 +289,25 @@ public class SneakyAssassins extends SoloGame
public void onPlayerInteractEntity(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() instanceof Villager)
{
event.setCancelled(true);
if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.EMERALD))
{
if (!Recharge.Instance.use(event.getPlayer(), "Bribe Villager", 8000, true, true))
return;
_npcManager.setBribed(event.getRightClicked(), event.getPlayer());
UtilInv.remove(event.getPlayer(), Material.EMERALD, (byte)0, 1);
UtilPlayer.message(event.getPlayer(), F.main("Game", "You used " + F.elem("Bribe Villager") + "."));
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.VILLAGER_YES, 1f, 1f);
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, event.getRightClicked().getLocation().add(0, 1, 0), 0.3f, 0.5f, 0.3f, 0, 10);
}
}
}
@EventHandler(ignoreCancelled = true)

View File

@ -0,0 +1,46 @@
package nautilus.game.arcade.game.games.sneakyassassins.kits;
import mineplex.core.common.util.*;
import mineplex.core.itemstack.*;
import nautilus.game.arcade.*;
import nautilus.game.arcade.kit.*;
import nautilus.game.arcade.kit.perks.*;
import org.bukkit.*;
import org.bukkit.entity.*;
import org.bukkit.inventory.*;
public class KitBriber extends SneakyAssassinKit
{
public KitBriber(ArcadeManager manager, EntityType disguiseType)
{
super(manager, "Briber", KitAvailability.Achievement,
new String[]
{
"Pay Villagers to attack other players!"
},
new Perk[]
{
new PerkSmokebomb(Material.INK_SACK, 3, true),
//new PerkBriber(),
},
new ItemStack(Material.EMERALD),
disguiseType);
}
@Override
public void GiveItems(Player player)
{
super.GiveItems(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 4,
C.cYellow + C.Bold + "Right-Click Villager" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Bribe Villager",
new String[]
{
ChatColor.RESET + "Pay a villager to help you.",
ChatColor.RESET + "It will attack the nearest",
ChatColor.RESET + "enemy for 15 seconds.",
}));
}
}

View File

@ -33,7 +33,7 @@ public class KitRevealer extends SneakyAssassinKit
{
super.GiveItems(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte) 0, 3,
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 3,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Reveal Assassins",
new String[]
{

View File

@ -0,0 +1,16 @@
package nautilus.game.arcade.game.games.sneakyassassins.npc;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class BribedData
{
public Player Player;
public Location LastLocation;
public long LastTime;
public BribedData(Player player)
{
Player = player;
}
}

View File

@ -4,6 +4,7 @@ import mineplex.core.common.util.*;
import mineplex.core.timing.TimingManager;
import mineplex.core.updater.*;
import mineplex.core.updater.event.*;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.game.*;
import nautilus.game.arcade.game.games.sneakyassassins.*;
import nautilus.game.arcade.world.*;
@ -12,6 +13,7 @@ import org.bukkit.block.*;
import org.bukkit.entity.*;
import org.bukkit.event.*;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.plugin.*;
import java.util.*;
@ -21,7 +23,9 @@ public class NpcManager implements Listener
private final SneakyAssassins _sneakyAssassins;
private final Random _random;
private EntityType _disguiseType = EntityType.VILLAGER;
private NautHashMap<Entity, BribedData> _bribed = new NautHashMap<Entity, BribedData>();
public NpcManager(SneakyAssassins sneakyAssassins, Random random)
{
_sneakyAssassins = sneakyAssassins;
@ -66,7 +70,7 @@ public class NpcManager implements Listener
return;
if (getGame().GetState() == Game.GameState.Live || getGame().GetState() == Game.GameState.Prepare)
bustle();
move();
}
@EventHandler
@ -91,12 +95,20 @@ public class NpcManager implements Listener
{
event.setDroppedExp(0);
event.getDrops().clear();
_bribed.remove(event.getEntity());
}
public void bustle()
public void move()
{
for (Entity npc : getNpcs())
{
if (_bribed.containsKey(npc))
{
if (bribedLogic(npc))
continue;
}
if (getRandom().nextInt(40) == 0)
{
List<Location> nearby = new ArrayList<>();
@ -136,6 +148,71 @@ public class NpcManager implements Listener
}
}
private boolean bribedLogic(Entity npc)
{
if (!(npc instanceof LivingEntity))
return false;
BribedData data = _bribed.get(npc);
if (data == null)
return false;
Player bestTarget = null;
double bestDist = 0;
for (Player other : _sneakyAssassins.GetPlayers(true))
{
if (data.Player.equals(other))
continue;
if (_sneakyAssassins.Manager.GetCondition().HasCondition(other, ConditionType.CLOAK, null))
continue;
double dist = UtilMath.offset(npc, other);
if (bestTarget == null || dist < bestDist)
{
bestTarget = other;
bestDist = dist;
}
}
if (bestTarget == null)
return false;
//Move
UtilEnt.CreatureMove(npc, bestTarget.getLocation().add(UtilAlg.getTrajectory(bestTarget, npc)), 0.8f);
//Stuck
if (data.LastLocation == null)
data.LastLocation = npc.getLocation();
if (UtilMath.offset(npc.getLocation(), data.LastLocation) > 1.5)
{
data.LastLocation = npc.getLocation();
data.LastTime = System.currentTimeMillis();
}
else
{
if (UtilTime.elapsed(data.LastTime, 800))
{
UtilAction.velocity(npc, 0.3, 0.3, 0.7, true);
}
}
if (UtilMath.offset(npc, bestTarget) < 1.5)
{
//Damage Event
_sneakyAssassins.Manager.GetDamage().NewDamageEvent(bestTarget, (LivingEntity)npc, null,
DamageCause.CUSTOM, 1, true, false, false,
data.Player.getName(), data.Player.getName() + "'s Bribed Villager");
npc.getWorld().playSound(npc.getLocation(), Sound.VILLAGER_NO, 1f, 1f);
}
return true;
}
public Random getRandom()
{
return _random;
@ -155,4 +232,9 @@ public class NpcManager implements Listener
{
_disguiseType = disguiseType;
}
public void setBribed(Entity ent, Player player)
{
_bribed.put(ent, new BribedData(player));
}
}

View File

@ -26,7 +26,6 @@ public class KitSmasher extends Kit
new Perk[]
{
new PerkMammoth(),
new PerkSeismicSlamHG()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SWORD));

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.kit.perks;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -12,6 +13,7 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
@ -21,10 +23,12 @@ public class PerkDoubleJump extends Perk
private double _power;
private double _heightMax;
private boolean _control;
private long _recharge;
private boolean _displayForce;
public PerkDoubleJump(String name, double power, double heightLimit, boolean control)
{
super("Jumper", new String[]
super(name, new String[]
{
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name
});
@ -32,6 +36,22 @@ public class PerkDoubleJump extends Perk
_power = power;
_heightMax = heightLimit;
_control = control;
_recharge = 0;
_displayForce = false;
}
public PerkDoubleJump(String name, double power, double heightLimit, boolean control, long recharge, boolean displayForce)
{
super(name, new String[]
{
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name
});
_power = power;
_heightMax = heightLimit;
_control = control;
_recharge = recharge;
_displayForce = displayForce;
}
@EventHandler
@ -63,6 +83,17 @@ public class PerkDoubleJump extends Perk
//Sound
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
//Recharge
if (_recharge > 0)
{
Recharge.Instance.useForce(player, GetName(), _recharge);
if (_displayForce)
{
Recharge.Instance.setDisplayForce(player, GetName(), true);
}
}
}
@EventHandler
@ -79,6 +110,9 @@ public class PerkDoubleJump extends Perk
if (!Kit.HasKit(player))
continue;
if (_recharge > 0 && !Recharge.Instance.usable(player, GetName()))
continue;
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
player.setAllowFlight(true);
}

View File

@ -74,12 +74,6 @@ public class PerkLazer extends Perk
if (!Kit.HasKit(player))
return;
if (!UtilEnt.isGrounded(player))
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while airborne."));
return;
}
if (!Recharge.Instance.use(player, GetName(), _recharge, true, true))
return;

View File

@ -52,7 +52,7 @@ public class PerkRevealer extends Perk implements IThrown
private static final FireworkEffect REVEALER_FIREWORK_EFFECT = FireworkEffect
.builder()
.flicker(false)
.withColor(Color.GREEN)
.withColor(Color.AQUA)
.with(FireworkEffect.Type.BALL_LARGE)
.trail(false)
.build();
@ -72,7 +72,7 @@ public class PerkRevealer extends Perk implements IThrown
public PerkRevealer()
{
super("Revealer", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Emerald to " + C.cGreen + "Throw Revealer"});
super("Revealer", new String[]{C.cYellow + "Right-Click" + C.cGray + " with Diamond to " + C.cGreen + "Throw Revealer"});
}
@EventHandler
@ -84,7 +84,7 @@ public class PerkRevealer extends Perk implements IThrown
if (event.getPlayer().getItemInHand() == null)
return;
if (event.getPlayer().getItemInHand().getType() != Material.EMERALD)
if (event.getPlayer().getItemInHand().getType() != Material.DIAMOND)
return;
Player player = event.getPlayer();
@ -94,10 +94,10 @@ public class PerkRevealer extends Perk implements IThrown
event.setCancelled(true);
UtilInv.remove(player, Material.EMERALD, (byte) 0, 1);
UtilInv.remove(player, Material.DIAMOND, (byte) 0, 1);
UtilInv.Update(player);
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.EMERALD));
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.DIAMOND));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1d);
}

View File

@ -29,12 +29,12 @@ public class PerkSeismicSlamHG extends Perk
{
super("Ground Pound", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Sword/Axe to " + C.cGreen + "Ground Pound"
C.cYellow + "Right-Click" + C.cGray + " with " + "Sword/Axe" + " to " + C.cGreen + "Ground Pound"
});
}
@EventHandler
public void Leap(PlayerInteractEvent event)
public void skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
@ -48,7 +48,7 @@ public class PerkSeismicSlamHG extends Perk
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE") && !event.getPlayer().getItemInHand().getType().toString().contains("_SWORD"))
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SWORD") && !event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
return;
Player player = event.getPlayer();

View File

@ -0,0 +1,96 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
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.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkSeismicSlamOITQ extends Perk
{
public PerkSeismicSlamOITQ()
{
super("Ground Pound", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with " + "SPADE" + " to " + C.cGreen + "Ground Pound"
});
}
@EventHandler
public void skill(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (event.getPlayer().getItemInHand() == null)
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 10000, true, true))
return;
//Action
double range = 8;
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
for (LivingEntity cur : targets.keySet())
{
if (cur.equals(player))
continue;
cur.playEffect(EntityEffect.HURT);
//Velocity
UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
0.8 * targets.get(cur), true, 0, 0.8 + 1.0 * targets.get(cur), 1.8, true);
//Condition
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
//Inform
if (cur instanceof Player)
UtilPlayer.message((Player)cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + "."));
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
//Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
}

View File

@ -10,15 +10,19 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
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.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
@ -32,22 +36,16 @@ public class PerkThrower extends Perk implements IThrown
{
super("Thrower", new String[]
{
C.cGray + "You can pick up team mates!",
C.cYellow + "Right-Click" + C.cGray + " with Sword to " + C.cGreen + "Throw Sheep",
C.cGray + "You can also pick up team mates!",
C.cYellow + "Drop Weapon" + C.cGray + " to " + C.cGreen + "Throw Sheep / Players",
});
}
@EventHandler
public void Throw(PlayerInteractEvent event)
public void Throw(PlayerDropItemEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
Player thrower = event.getPlayer();
if (!UtilGear.isMat(thrower.getItemInHand(), Material.IRON_SWORD))
return;
if (thrower.getPassenger() == null)
return;
@ -73,6 +71,8 @@ public class PerkThrower extends Perk implements IThrown
fThrower.setPassenger(fThroweeStack);
}
}, 2);
UtilPlayer.message(thrower, F.main("Game", "You threw " + UtilEnt.getName(throwee) + "."));
}
//Throw

View File

@ -12,10 +12,12 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class IdleManager implements Listener
@ -33,6 +35,19 @@ public class IdleManager implements Listener
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
}
@EventHandler
public void ChatIdle(final AsyncPlayerChatEvent event)
{
Bukkit.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
{
@Override
public void run()
{
_idle.put(event.getPlayer(), System.currentTimeMillis());
}
}, 1);
}
@EventHandler
public void KickIdlePlayers(UpdateEvent event)

View File

@ -22,6 +22,16 @@ public class KeenEyeStatTracker extends StatTracker<Draw>
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() != Game.GameState.Prepare)
return;
for (Player player : event.GetGame().GetPlayers(true))
_guessAll.add(player);
}
@EventHandler
public void onDrawRoundEnd(DrawRoundEndEvent event)
{

View File

@ -8,6 +8,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
public class KillEntityStatTracker extends StatTracker<Game>
@ -24,23 +25,19 @@ public class KillEntityStatTracker extends StatTracker<Game>
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onEntityDeath(EntityDeathEvent event)
public void onKillingBlow(CustomDamageEvent event)
{
if (event.getEntity().getType() != getEntityType())
if (event.GetDamageeEntity().getType() != getEntityType())
return;
if (!(event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent))
if (!event.GetDamageeEntity().isDead())
return;
EntityDamageByEntityEvent edbee = (EntityDamageByEntityEvent) event.getEntity();
Player damager = null;
if (edbee.getDamager() instanceof Player)
damager = (Player) edbee.getDamager();
else if (edbee.getDamager() instanceof Projectile && ((Projectile) edbee.getDamager()).getShooter() instanceof Player)
damager = (Player) ((Projectile) edbee.getDamager()).getShooter();
if (damager != null)
addStat(damager, getStatName(), 1, false, false);
Player player = event.GetDamagerPlayer(true);
if (player == null)
return;
addStat(player, getStatName(), 1, false, false);
}
public String getStatName()

View File

@ -20,7 +20,7 @@ public class PureLuckStatTracker extends StatTracker<Draw>
if (getGame().GetState() != Game.GameState.Live)
return;
if (System.currentTimeMillis() - event.getDrawRound().Time < 5000)
if (System.currentTimeMillis() - event.getDrawRound().Time < 8000)
addStat(event.getPlayer(), "PureLuck", 1, true, false);
}
}