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

This commit is contained in:
Jonathan Williams 2015-11-30 23:49:32 -06:00
commit 633697dc7a
17 changed files with 458 additions and 23 deletions

View File

@ -843,4 +843,398 @@ public class UtilBlock
return blocks;
}
public static ItemStack blockToInventoryItemStack(Block block)
{
ItemStack itemStack = new ItemStack(block.getType(), 1, block.getData());
switch (block.getType())
{
case SAPLING:
itemStack.setDurability((short) 0);
break;
case WATER:
itemStack.setType(Material.WATER_BUCKET);
itemStack.setDurability((short) 0);
break;
case STATIONARY_WATER:
itemStack.setType(Material.WATER_BUCKET);
itemStack.setDurability((short) 0);
break;
case LAVA:
itemStack.setType(Material.LAVA_BUCKET);
itemStack.setDurability((short) 0);
break;
case STATIONARY_LAVA:
itemStack.setType(Material.LAVA_BUCKET);
itemStack.setDurability((short) 0);
break;
case LOG:
itemStack.setDurability((short) (itemStack.getDurability() % 4));
break;
case LEAVES:
itemStack.setDurability((short) (itemStack.getDurability() % 4));
break;
case DISPENSER:
itemStack.setDurability((short) 0);
break;
case BED_BLOCK:
itemStack.setType(Material.BED);
itemStack.setDurability((short) 0);
break;
case POWERED_RAIL:
itemStack.setDurability((short) 0);
break;
case DETECTOR_RAIL:
itemStack.setDurability((short) 0);
break;
case PISTON_STICKY_BASE:
itemStack.setDurability((short) 0);
break;
case PISTON_BASE:
itemStack.setDurability((short) 0);
break;
case PISTON_EXTENSION:
itemStack.setType(Material.AIR);
itemStack.setDurability((short) 0);
break;
case PISTON_MOVING_PIECE:
itemStack.setType(Material.AIR);
itemStack.setDurability((short) 0);
break;
case DOUBLE_STEP:
itemStack.setType(Material.STEP);
itemStack.setAmount(2);
break;
case STEP:
itemStack.setDurability((short) (itemStack.getDurability() % 8));
break;
case TORCH:
itemStack.setDurability((short) 0);
break;
case FIRE:
itemStack.setType(Material.FIREBALL);
itemStack.setDurability((short) 0);
break;
case WOOD_STAIRS:
itemStack.setDurability((short) 0);
break;
case CHEST:
itemStack.setDurability((short) 0);
break;
case REDSTONE_WIRE:
itemStack.setType(Material.REDSTONE);
itemStack.setDurability((short) 0);
break;
case CROPS:
itemStack.setType(Material.SEEDS);
itemStack.setDurability((short) 0);
break;
case SOIL:
itemStack.setType(Material.DIRT);
itemStack.setDurability((short) 0);
break;
case FURNACE:
itemStack.setDurability((short) 0);
break;
case BURNING_FURNACE:
itemStack.setType(Material.FURNACE);
itemStack.setDurability((short) 0);
break;
case SIGN_POST:
itemStack.setType(Material.SIGN);
itemStack.setDurability((short) 0);
break;
case WOODEN_DOOR:
itemStack.setType(Material.WOOD_DOOR);
itemStack.setDurability((short) 0);
break;
case LADDER:
itemStack.setDurability((short) 0);
break;
case RAILS:
itemStack.setDurability((short) 0);
break;
case COBBLESTONE_STAIRS:
itemStack.setDurability((short) 0);
break;
case WALL_SIGN:
itemStack.setType(Material.SIGN);
itemStack.setDurability((short) 0);
break;
case LEVER:
itemStack.setDurability((short) 0);
break;
case STONE_PLATE:
itemStack.setDurability((short) 0);
break;
case IRON_DOOR_BLOCK:
itemStack.setType(Material.IRON_DOOR);
itemStack.setDurability((short) 0);
break;
case WOOD_PLATE:
itemStack.setDurability((short) 0);
break;
case GLOWING_REDSTONE_ORE:
itemStack.setType(Material.REDSTONE_ORE);
break;
case REDSTONE_TORCH_OFF:
itemStack.setType(Material.REDSTONE_TORCH_ON);
itemStack.setDurability((short) 0);
break;
case REDSTONE_TORCH_ON:
itemStack.setDurability((short) 0);
break;
case STONE_BUTTON:
itemStack.setDurability((short) 0);
break;
case SNOW:
itemStack.setAmount(1 + itemStack.getDurability());
itemStack.setDurability((short) 0);
break;
case CACTUS:
itemStack.setDurability((short) 0);
break;
case SUGAR_CANE_BLOCK:
itemStack.setType(Material.SUGAR_CANE);
itemStack.setDurability((short) 0);
break;
case JUKEBOX:
itemStack.setDurability((short) 0);
break;
case PORTAL:
itemStack.setType(Material.AIR);
itemStack.setDurability((short) 0);
break;
case CAKE_BLOCK:
itemStack.setType(Material.CAKE);
itemStack.setDurability((short) 0);
break;
case DIODE_BLOCK_OFF:
itemStack.setType(Material.DIODE);
itemStack.setDurability((short) 0);
break;
case DIODE_BLOCK_ON:
itemStack.setType(Material.DIODE);
itemStack.setDurability((short) 0);
break;
case TRAP_DOOR:
itemStack.setDurability((short) 0);
break;
case HUGE_MUSHROOM_1:
itemStack.setDurability((short) 0);
break;
case HUGE_MUSHROOM_2:
itemStack.setDurability((short) 0);
break;
case PUMPKIN_STEM:
itemStack.setType(Material.PUMPKIN_SEEDS);
itemStack.setDurability((short) 0);
break;
case MELON_STEM:
itemStack.setType(Material.MELON_SEEDS);
itemStack.setDurability((short) 0);
break;
case VINE:
itemStack.setDurability((short) 0);
break;
case FENCE_GATE:
itemStack.setDurability((short) 0);
break;
case BRICK_STAIRS:
itemStack.setDurability((short) 0);
break;
case SMOOTH_STAIRS:
itemStack.setDurability((short) 0);
break;
case NETHER_BRICK_STAIRS:
itemStack.setDurability((short) 0);
break;
case NETHER_WARTS:
itemStack.setType(Material.NETHER_STALK);
itemStack.setDurability((short) 0);
break;
case BREWING_STAND:
itemStack.setType(Material.BREWING_STAND_ITEM);
itemStack.setDurability((short) 0);
break;
case CAULDRON:
itemStack.setType(Material.CAULDRON_ITEM);
itemStack.setDurability((short) 0);
break;
case ENDER_PORTAL:
itemStack.setType(Material.AIR);
itemStack.setDurability((short) 0);
break;
case ENDER_PORTAL_FRAME:
itemStack.setDurability((short) 0);
break;
case REDSTONE_LAMP_ON:
itemStack.setType(Material.REDSTONE_LAMP_OFF);
break;
case WOOD_DOUBLE_STEP:
itemStack.setType(Material.WOOD_STEP);
itemStack.setAmount(2);
break;
case WOOD_STEP:
itemStack.setDurability((short) (itemStack.getDurability() % 8));
break;
case COCOA:
itemStack.setType(Material.INK_SACK);
itemStack.setDurability((short) 3);
break;
case SANDSTONE_STAIRS:
itemStack.setDurability((short) 0);
break;
case ENDER_CHEST:
itemStack.setDurability((short) 0);
break;
case TRIPWIRE_HOOK:
itemStack.setDurability((short) 0);
break;
case TRIPWIRE:
itemStack.setType(Material.STRING);
itemStack.setDurability((short) 0);
break;
case SPRUCE_WOOD_STAIRS:
itemStack.setDurability((short) 0);
break;
case BIRCH_WOOD_STAIRS:
itemStack.setDurability((short) 0);
break;
case JUNGLE_WOOD_STAIRS:
itemStack.setDurability((short) 0);
break;
case COMMAND:
itemStack.setDurability((short) 0);
break;
case FLOWER_POT:
itemStack.setType(Material.FLOWER_POT_ITEM);
itemStack.setDurability((short) 0);
break;
case CARROT:
itemStack.setType(Material.CARROT_ITEM);
itemStack.setDurability((short) 0);
break;
case POTATO:
itemStack.setType(Material.POTATO_ITEM);
itemStack.setDurability((short) 0);
break;
case WOOD_BUTTON:
itemStack.setDurability((short) 0);
break;
case SKULL:
itemStack.setType(Material.SKULL_ITEM);
break;
case TRAPPED_CHEST:
itemStack.setDurability((short) 0);
break;
case GOLD_PLATE:
itemStack.setDurability((short) 0);
break;
case IRON_PLATE:
itemStack.setDurability((short) 0);
break;
case REDSTONE_COMPARATOR_OFF:
itemStack.setType(Material.REDSTONE_COMPARATOR);
itemStack.setDurability((short) 0);
break;
case REDSTONE_COMPARATOR_ON:
itemStack.setType(Material.REDSTONE_COMPARATOR);
itemStack.setDurability((short) 0);
break;
case DAYLIGHT_DETECTOR:
itemStack.setDurability((short) 0);
break;
case HOPPER:
itemStack.setDurability((short) 0);
break;
case QUARTZ_STAIRS:
itemStack.setDurability((short) 0);
break;
case ACTIVATOR_RAIL:
itemStack.setDurability((short) 0);
break;
case DROPPER:
itemStack.setDurability((short) 0);
break;
case LEAVES_2:
itemStack.setDurability((short) (itemStack.getDurability() % 4));
break;
case LOG_2:
itemStack.setDurability((short) (itemStack.getDurability() % 4));
break;
case ACACIA_STAIRS:
itemStack.setDurability((short) 0);
break;
case DARK_OAK_STAIRS:
itemStack.setDurability((short) 0);
break;
case IRON_TRAPDOOR:
itemStack.setDurability((short) 0);
break;
case HAY_BLOCK:
itemStack.setDurability((short) 0);
break;
case STANDING_BANNER:
itemStack.setType(Material.BANNER);
itemStack.setDurability((short) 0);
break;
case WALL_BANNER:
itemStack.setType(Material.BANNER);
itemStack.setDurability((short) 0);
break;
case DAYLIGHT_DETECTOR_INVERTED:
itemStack.setType(Material.DAYLIGHT_DETECTOR);
itemStack.setDurability((short) 0);
break;
case RED_SANDSTONE_STAIRS:
itemStack.setDurability((short) 0);
break;
case DOUBLE_STONE_SLAB2:
itemStack.setType(Material.STONE_SLAB2);
itemStack.setAmount(2);
break;
case STONE_SLAB2:
itemStack.setDurability((short) (itemStack.getDurability() % 8));
break;
case SPRUCE_FENCE_GATE:
itemStack.setDurability((short) 0);
break;
case BIRCH_FENCE_GATE:
itemStack.setDurability((short) 0);
break;
case JUNGLE_FENCE_GATE:
itemStack.setDurability((short) 0);
break;
case DARK_OAK_FENCE_GATE:
itemStack.setDurability((short) 0);
break;
case ACACIA_FENCE_GATE:
itemStack.setDurability((short) 0);
break;
case SPRUCE_DOOR:
itemStack.setType(Material.SPRUCE_DOOR_ITEM);
itemStack.setDurability((short) 0);
break;
case BIRCH_DOOR:
itemStack.setType(Material.BIRCH_DOOR_ITEM);
itemStack.setDurability((short) 0);
break;
case JUNGLE_DOOR:
itemStack.setType(Material.JUNGLE_DOOR_ITEM);
itemStack.setDurability((short) 0);
break;
case ACACIA_DOOR:
itemStack.setType(Material.ACACIA_DOOR_ITEM);
itemStack.setDurability((short) 0);
break;
case DARK_OAK_DOOR:
itemStack.setType(Material.DARK_OAK_DOOR_ITEM);
itemStack.setDurability((short) 0);
break;
}
return itemStack;
}
}

View File

@ -30,7 +30,7 @@ public class ItemFirework extends ItemGadget
},
-1,
Material.FIREWORK, (byte)0,
250, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50));
500, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50));
}
@Override

View File

@ -140,7 +140,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
{
Item melon = melonIterator.next();
if (melon.isDead() || !melon.isValid() || melon.getTicksLived() > 400)
if (melon.isDead() || !melon.isValid() || melon.getTicksLived() > 100)
{
melonIterator.remove();
melon.remove();

View File

@ -70,7 +70,7 @@ public class ItemTNT extends ItemGadget
double mult = players.get(player);
//Knockback
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 2 * mult, false, 0, 0.5 + 1 * mult, 10, true);
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 1 * mult, false, 0, 0.5 + 0.5 * mult, 10, true);
}
// Simulating explosion to prevent water from being evaporated.

View File

@ -85,7 +85,7 @@ public class MorphBat extends MorphGadget implements IThrown
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 100, false, false))
if (!Recharge.Instance.use(player, GetName(), 100, false, false, "Cosmetics"))
return;
//Effect
@ -106,7 +106,7 @@ public class MorphBat extends MorphGadget implements IThrown
if (!IsActive(player))
return;
if (!Recharge.Instance.use(player, "Poop", 4000, true, false))
if (!Recharge.Instance.use(player, "Poop", 4000, true, false, "Cosmetics"))
return;
//Action

View File

@ -76,7 +76,7 @@ public class MorphChicken extends MorphGadget
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 100, false, false))
if (!Recharge.Instance.use(player, GetName(), 100, false, false, "Cosmetics"))
return;
Vector offset = player.getLocation().getDirection();

View File

@ -57,7 +57,7 @@ public class MorphCow extends MorphGadget
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 2500, false, false))
if (!Recharge.Instance.use(player, GetName(), 2500, false, false, "Cosmetics"))
return;
player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 1f, 1f);

View File

@ -119,7 +119,7 @@ public class MorphCreeper extends MorphGadget
double mult = players.get(other);
//Knockback
UtilAction.velocity(other, UtilAlg.getTrajectory(player.getLocation(), other.getLocation()), 1 + 1.5 * mult, false, 0, 0.5 + 1 * mult, 3, true);
UtilAction.velocity(other, UtilAlg.getTrajectory(player.getLocation(), other.getLocation()), 1 + 1 * mult, false, 0, 0.6 + 0.6 * mult, 3, true);
}
}
}

View File

@ -78,7 +78,7 @@ public class MorphEnderman extends MorphGadget
player.setAllowFlight(false);
//Set Recharge
Recharge.Instance.use(player, GetName(), 2000, false, false);
Recharge.Instance.use(player, GetName(), 2000, false, false, "Cosmetics");
//Smoke Trail
Block lastSmoke = player.getLocation().getBlock();

View File

@ -73,7 +73,7 @@ public class MorphPig extends MorphGadget
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 400, false, false))
if (!Recharge.Instance.use(player, GetName(), 400, false, false, "Cosmetics"))
return;
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(0.75 + Math.random() * 0.5));

View File

@ -83,7 +83,7 @@ public class MorphSlime extends MorphGadget
if (!UtilEnt.isGrounded(player))
return;
if (!Recharge.Instance.use(player, GetName(), 1000, false, false))
if (!Recharge.Instance.use(player, GetName(), 1000, false, false, "Cosmetics"))
return;
player.getWorld().playSound(player.getLocation(), Sound.SLIME_ATTACK, 1f, 1f);

View File

@ -94,7 +94,7 @@ public class MorphTitan extends MorphGadget
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, "Guardians Laser", 4000, true, false))
if (!Recharge.Instance.use(player, "Guardians Laser", 6000, true, false, "Cosmetics"))
return;
DisguiseBase base = Manager.getDisguiseManager().getDisguise(player);
@ -148,7 +148,7 @@ public class MorphTitan extends MorphGadget
double mult = players.get(ent);
//Knockback
UtilAction.velocity(ent, UtilAlg.getTrajectory(stand.getLocation(), ent.getLocation()), 3 * mult, false, 0, 1 + 2 * mult, 10, true);
UtilAction.velocity(ent, UtilAlg.getTrajectory(stand.getLocation(), ent.getLocation()), 2 * mult, false, 0, 1 + 1 * mult, 10, true);
}
//Sound

View File

@ -87,7 +87,7 @@ public class MorphVillager extends MorphGadget implements IThrown
return;
}
if (!Recharge.Instance.use(player, GetName(), 800, false, false))
if (!Recharge.Instance.use(player, GetName(), 800, false, false, "Cosmetics"))
return;
player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_IDLE, 1f, 1f);

View File

@ -96,7 +96,7 @@ public class MorphWither extends MorphGadget
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 1600, false, false))
if (!Recharge.Instance.use(player, GetName(), 2500, false, false, "Cosmetics"))
return;
Vector offset = player.getLocation().getDirection();

View File

@ -153,7 +153,7 @@ public abstract class ItemGadget extends Gadget
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), _recharge, _recharge > 1000, false))
if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"))
{
UtilInv.Update(player);
return;

View File

@ -29,6 +29,9 @@ public class Recharge extends MiniPlugin
public HashSet<String> informSet = new HashSet<String>();
public NautHashMap<String, NautHashMap<String, RechargeData>> _recharge = new NautHashMap<String, NautHashMap<String, RechargeData>>();
//Used to increase cooldown when gadgets are being spammed
public NautHashMap<String, ArrayList<Long>> _gadgetSlow = new NautHashMap<String, ArrayList<Long>>();
protected Recharge(JavaPlugin plugin)
{
super("Recharge", plugin);
@ -76,10 +79,22 @@ public class Recharge extends MiniPlugin
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (event.getType() == UpdateType.TICK)
recharge();
recharge();
if (event.getType() == UpdateType.SLOW)
for (ArrayList<Long> times : _gadgetSlow.values())
{
Iterator<Long> timeIter = times.iterator();
while (timeIter.hasNext())
{
long time = timeIter.next();
if (UtilTime.elapsed(time, 20000))
timeIter.remove();
}
}
}
public void recharge()
@ -112,24 +127,40 @@ public class Recharge extends MiniPlugin
public boolean use(Player player, String ability, long recharge, boolean inform, boolean attachItem)
{
return use(player, ability, ability, recharge, inform, attachItem);
return use(player, ability, ability, recharge, inform, attachItem, false, true, null);
}
public boolean use(Player player, String ability, long recharge, boolean inform, boolean attachItem, String cooldownPool)
{
return use(player, ability, ability, recharge, inform, attachItem, false, true, cooldownPool);
}
public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform, boolean attachItem)
{
return use(player, ability, abilityFull, recharge, inform, attachItem, false, true);
return use(player, ability, abilityFull, recharge, inform, attachItem, false, true, null);
}
public boolean use(Player player, String ability, long recharge, boolean inform, boolean attachItem, boolean attachDurability)
{
return use(player, ability, ability, recharge, inform, attachItem, attachDurability, true);
return use(player, ability, ability, recharge, inform, attachItem, attachDurability, true, null);
}
public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform,
boolean attachItem, boolean attachDurability, boolean clearOnDeath)
boolean attachItem, boolean attachDurability, boolean clearOnDeath, String cooldownPool)
{
if (recharge == 0)
return true;
//Cooldown Pool
if (cooldownPool != null)
{
if (!_gadgetSlow.containsKey(cooldownPool))
_gadgetSlow.put(cooldownPool, new ArrayList<Long>());
int count = _gadgetSlow.get(cooldownPool).size();
recharge += count * 40;
}
//Ensure Expirey
recharge();
@ -149,6 +180,10 @@ public class Recharge extends MiniPlugin
return false;
}
//Add Slow
if (cooldownPool != null)
_gadgetSlow.get(cooldownPool).add(System.currentTimeMillis());
//Insert
UseRecharge(player, ability, recharge, attachItem, attachDurability, clearOnDeath);

View File

@ -66,6 +66,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.util.Vector;
public class GameFlagManager implements Listener
@ -676,6 +677,11 @@ public class GameFlagManager implements Listener
final Player player = event.getEntity();
//Remove all conditions
Manager.GetCondition().EndCondition(player, null, null);
for (PotionEffect potion : player.getActivePotionEffects())
player.removePotionEffect(potion.getType());
//Visual
Manager.GetCondition().Factory().Blind("Ghost", player, player, 2.5, 0, false, false, false);