Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
6f14c75f70
@ -32,7 +32,7 @@ public class GiveawayMessageHandler implements CommandCallback
|
|||||||
int count = message.getTitanCount();
|
int count = message.getTitanCount();
|
||||||
String countString = count + UtilTime.getDayOfMonthSuffix(count);
|
String countString = count + UtilTime.getDayOfMonthSuffix(count);
|
||||||
String chatMessage = C.cRed + playerName + C.cWhite + " has become the " + C.cRed + countString + " Titan ";
|
String chatMessage = C.cRed + playerName + C.cWhite + " has become the " + C.cRed + countString + " Titan ";
|
||||||
UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, UtilServer.getPlayers());
|
UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, UtilServer.getPlayers());
|
||||||
World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0);
|
World world = UtilServer.getPlayers().length > 0 ? UtilServer.getPlayers()[0].getWorld() : Bukkit.getWorlds().get(0);
|
||||||
LightFlicker lightFlicker = new LightFlicker(world);
|
LightFlicker lightFlicker = new LightFlicker(world);
|
||||||
lightFlicker.runTaskTimer(_plugin, 1, 1);
|
lightFlicker.runTaskTimer(_plugin, 1, 1);
|
||||||
|
@ -28,7 +28,7 @@ public class TitanGiveawayAnimation implements Listener
|
|||||||
_location = start.clone();
|
_location = start.clone();
|
||||||
_duration = duration;
|
_duration = duration;
|
||||||
_startTime = System.currentTimeMillis();
|
_startTime = System.currentTimeMillis();
|
||||||
_worldTime = start.getWorld().getTime();
|
// _worldTime = start.getWorld().getTime();
|
||||||
Bukkit.getPluginManager().registerEvents(this, manager.getPlugin());
|
Bukkit.getPluginManager().registerEvents(this, manager.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,17 +49,17 @@ public class TitanGiveawayAnimation implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_location.getWorld().setTime(UtilMath.random.nextLong());
|
// _location.getWorld().setTime(UtilMath.random.nextLong());
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 5, 5);
|
player.playSound(_location, Sound.ORB_PICKUP, 5, 5);
|
||||||
UtilFirework.packetPlayFirework(player, player.getLocation(), Type.BURST, Color.RED, true, false);
|
UtilFirework.packetPlayFirework(player, _location, Type.BURST, Color.RED, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void remove()
|
private void remove()
|
||||||
{
|
{
|
||||||
_location.getWorld().setTime(_worldTime);
|
// _location.getWorld().setTime(_worldTime);
|
||||||
HandlerList.unregisterAll(this);
|
HandlerList.unregisterAll(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.core.titangiveaway;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
@ -107,11 +108,19 @@ public class TitanGiveawayManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
// @EventHandler
|
||||||
// public void onCommand(PlayerCommandPreprocessEvent event)
|
// public void onCommand(final PlayerCommandPreprocessEvent event)
|
||||||
// {
|
// {
|
||||||
// if (event.getMessage().contains("pumpkin"))
|
// if (event.getMessage().contains("pumpkin"))
|
||||||
// {
|
// {
|
||||||
// openPumpkin(event.getPlayer(), null);
|
// openPumpkin(event.getPlayer(), new Runnable()
|
||||||
|
// {
|
||||||
|
// @Override
|
||||||
|
// public void run()
|
||||||
|
// {
|
||||||
|
// Location location = event.getPlayer().getLocation().add(1, 0.5, 1);
|
||||||
|
// new TitanGiveawayAnimation(TitanGiveawayManager.this, location, 3000L);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
// event.setCancelled(true);
|
// event.setCancelled(true);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
@ -15,6 +15,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
|
|||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.titangiveaway.TitanGiveawayAnimation;
|
||||||
import mineplex.core.titangiveaway.TitanGiveawayManager;
|
import mineplex.core.titangiveaway.TitanGiveawayManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
@ -27,6 +28,7 @@ import net.minecraft.server.v1_7_R4.TileEntity;
|
|||||||
import net.minecraft.server.v1_7_R4.TileEntityEnderChest;
|
import net.minecraft.server.v1_7_R4.TileEntityEnderChest;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -89,6 +91,7 @@ public class HolidayManager implements Listener
|
|||||||
private HashSet<Item> _eggs = new HashSet<Item>();
|
private HashSet<Item> _eggs = new HashSet<Item>();
|
||||||
|
|
||||||
private HashSet<Item> _coins = new HashSet<Item>();
|
private HashSet<Item> _coins = new HashSet<Item>();
|
||||||
|
private HashSet<Item> _gems = new HashSet<Item>();
|
||||||
|
|
||||||
public long _lastSpawn = System.currentTimeMillis();
|
public long _lastSpawn = System.currentTimeMillis();
|
||||||
|
|
||||||
@ -316,13 +319,13 @@ public class HolidayManager implements Listener
|
|||||||
specialBlockBreak(event.getPlayer(), event.getBlock());
|
specialBlockBreak(event.getPlayer(), event.getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void specialBlockBreak(Player player, Block block)
|
private void specialBlockBreak(Player player, final Block block)
|
||||||
{
|
{
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType());
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, type.getBlockType());
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
|
|
||||||
//Coins
|
//Coins
|
||||||
for (int i=0 ; i < 4 + Math.random()*16 ; i++)
|
for (int i=0 ; i < 4 + Math.random()*8 ; i++)
|
||||||
{
|
{
|
||||||
Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5),
|
Item coin = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5),
|
||||||
ItemStackFactory.Instance.CreateStack(175, (byte)0, 1, UtilMath.r(999999) + "Coin"));
|
ItemStackFactory.Instance.CreateStack(175, (byte)0, 1, UtilMath.r(999999) + "Coin"));
|
||||||
@ -339,6 +342,24 @@ public class HolidayManager implements Listener
|
|||||||
_coins.add(coin);
|
_coins.add(coin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Gems
|
||||||
|
for (int i=0 ; i < 4 + Math.random()*16 ; i++)
|
||||||
|
{
|
||||||
|
Item gem = block.getWorld().dropItem(block.getLocation().add(0.5, 1, 0.5),
|
||||||
|
ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, UtilMath.r(999999) + "Gem"));
|
||||||
|
|
||||||
|
Vector vel = new Vector(
|
||||||
|
(Math.random() - 0.5) * 0.5,
|
||||||
|
0.1 + Math.random() * 0.3,
|
||||||
|
(Math.random() - 0.5) * 0.5);
|
||||||
|
|
||||||
|
gem.setVelocity(vel);
|
||||||
|
|
||||||
|
gem.setPickupDelay(20);
|
||||||
|
|
||||||
|
_gems.add(gem);
|
||||||
|
}
|
||||||
|
|
||||||
// Titan Giveaway
|
// Titan Giveaway
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
@ -347,7 +368,8 @@ public class HolidayManager implements Listener
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
// TODO
|
Location location = block.getLocation().add(0.5, 0.5, 0.5);
|
||||||
|
new TitanGiveawayAnimation(_titanManager, location, 3000L);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -371,6 +393,15 @@ public class HolidayManager implements Listener
|
|||||||
|
|
||||||
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f);
|
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f);
|
||||||
}
|
}
|
||||||
|
else if (_gems.contains(event.getItem()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getItem().remove();
|
||||||
|
|
||||||
|
Manager.GetDonation().RewardGems(null, type + " Gems", event.getPlayer().getName(), event.getPlayer().getUniqueId(), 4 * event.getItem().getItemStack().getAmount());
|
||||||
|
|
||||||
|
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1f, 2f);
|
||||||
|
}
|
||||||
|
|
||||||
else if (_eggs.contains(event.getItem()))
|
else if (_eggs.contains(event.getItem()))
|
||||||
{
|
{
|
||||||
@ -397,6 +428,19 @@ public class HolidayManager implements Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Iterator<Item> gemIterator = _gems.iterator();
|
||||||
|
|
||||||
|
while (gemIterator.hasNext())
|
||||||
|
{
|
||||||
|
Item gem = gemIterator.next();
|
||||||
|
|
||||||
|
if (!gem.isValid() || gem.getTicksLived() > 1200)
|
||||||
|
{
|
||||||
|
gem.remove();
|
||||||
|
gemIterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Iterator<Item> eggIterator = _eggs.iterator();
|
Iterator<Item> eggIterator = _eggs.iterator();
|
||||||
|
|
||||||
while (eggIterator.hasNext())
|
while (eggIterator.hasNext())
|
||||||
|
Loading…
Reference in New Issue
Block a user