Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex into bench

This commit is contained in:
Aaron Brock 2015-06-19 18:13:48 -04:00
commit 61494f93ba
14 changed files with 155 additions and 16 deletions

View File

@ -12,9 +12,9 @@ public enum Rank
OWNER("Owner", ChatColor.DARK_RED),
DEVELOPER("Dev", ChatColor.RED),
ADMIN("Admin", ChatColor.RED),
JR_DEV("Jr. Dev", ChatColor.GOLD),
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
MODERATOR("Mod", ChatColor.GOLD),
JNR_DEV("Jr.Dev", ChatColor.GOLD),
HELPER("Trainee", ChatColor.DARK_AQUA),
MAPLEAD("MapLead", ChatColor.DARK_PURPLE),
MAPDEV("Builder", ChatColor.BLUE),

View File

@ -28,6 +28,7 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.chat.command.BroadcastCommand;
import mineplex.core.chat.command.SilenceCommand;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -301,8 +302,15 @@ public class Chat extends MiniPlugin
event.setCancelled(true);
return;
}
else if (_clientManager.Get(sender).GetRank() == Rank.ALL &&
!Recharge.Instance.use(sender, "All Chat Message", 3000, false, false))
{
UtilPlayer.message(sender, C.cYellow + "You can only chat once every 3 seconds to prevent spam.");
UtilPlayer.message(sender, C.cYellow + "Buy a Rank at " + C.cGreen + "www.mineplex.com/shop" + C.cYellow + " to remove this limit!");
event.setCancelled(true);
}
else if (!_clientManager.Get(sender).GetRank().Has(Rank.MODERATOR) &&
!Recharge.Instance.use(sender, "Chat Message", 500, false, false))
!Recharge.Instance.use(sender, "Chat Message", 400, false, false))
{
UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast."));
event.setCancelled(true);

View File

@ -0,0 +1,85 @@
package mineplex.core.notifier;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class NotificationManager extends MiniPlugin
{
private boolean _enabled = true;
private CoreClientManager _clientManager;
private String _summerLine =
C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" +
C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" +
C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" +
C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" +
C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" +
C.cYellow + "" + C.cGold + "" + C.cYellow + "" + C.cGold + "" + C.cYellow + "";
public NotificationManager(JavaPlugin plugin, CoreClientManager client)
{
super("Notification Manager", plugin);
_clientManager = client;
}
@EventHandler
public void notify(UpdateEvent event)
{
if (!_enabled)
return;
if (event.getType() != UpdateType.MIN_08)
return;
for (Player player : UtilServer.getPlayers())
{
Rank rank = _clientManager.Get(player).GetRank();
if (rank.Has(Rank.LEGEND))
continue;
UtilPlayer.message(player, _summerLine);
UtilPlayer.message(player, " ");
UtilPlayer.message(player, " " +
C.cGreen + C.Bold + "75% OFF" +
C.cYellow + C.Bold + " SUMMER SUPER SALE " +
C.cGreen + C.Bold + "75% OFF");
UtilPlayer.message(player, " ");
if (rank == Rank.ALL)
{
UtilPlayer.message(player, C.cWhite + " " + player.getName() + ", you can get 75% Off " + C.cAqua + C.Bold + "All Lifetime Ranks" + C.cWhite + "!");
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, available " + C.cRed + C.Line + "this weekend only" + C.cWhite + "!");
}
else if (rank == Rank.ULTRA)
{
UtilPlayer.message(player, C.cWhite + " Hello " + player.getName() + ", upgrade to " + C.cPurple + C.Bold + "HERO RANK" + C.cWhite + " for only $7.50!");
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, available " + C.cRed + C.Line + "this weekend only" + C.cWhite + "!");
}
else if (rank == Rank.HERO)
{
UtilPlayer.message(player, C.cWhite + " Hello " + player.getName() + ", upgrade to " + C.cGreen + C.Bold + "LEGEND RANK" + C.cWhite + " for only $7.50!");
UtilPlayer.message(player, C.cWhite + " This is our biggest sale ever, available " + C.cRed + C.Line + "this weekend only" + C.cWhite + "!");
}
UtilPlayer.message(player, " ");
UtilPlayer.message(player, " " + C.cGreen + "www.mineplex.com/shop");
UtilPlayer.message(player, " ");
//UtilPlayer.message(player, C.cRed + C.Bold + " This Weekend Only!");
UtilPlayer.message(player, _summerLine);
}
}
}

View File

@ -73,6 +73,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.message.PrivateMessageEvent;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.notifier.NotificationManager;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager;
import mineplex.core.pet.PetManager;
@ -192,6 +193,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
_statsManager = statsManager;
_achievementManager = achievementManager;
_achievementManager.setGiveInterfaceItem(true);
new NotificationManager(getPlugin(), clientManager);
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;

View File

@ -11,6 +11,7 @@ public enum GameType
BaconBrawl("Bacon Brawl"),
Barbarians("A Barbarians Life"),
Bridge("The Bridges"),
Build("Master Builders"),
CastleSiege("Castle Siege"),
ChampionsTDM("Champions TDM", "Champions"),
ChampionsDominate("Champions Domination", "Champions"),

View File

@ -63,6 +63,7 @@ import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.movement.Movement;
import mineplex.core.notifier.NotificationManager;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketInfo;
@ -284,6 +285,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
new SoupAddon(plugin, this);
new TeamArmorAddon(plugin, this);
new NotificationManager(getPlugin(), clientManager);
//Champions Modules
_energy = new Energy(plugin);

View File

@ -10,7 +10,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
{
public GameCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "game");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD, Rank.JNR_DEV}, "game");
AddCommand(new StartCommand(Plugin));
AddCommand(new StopCommand(Plugin));

View File

@ -19,7 +19,7 @@ public class SetCommand extends CommandBase<ArcadeManager>
{
public SetCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "set");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD, Rank.JNR_DEV}, "set");
}
@Override

View File

@ -12,7 +12,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
{
public StartCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD}, "start");
super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPLEAD, Rank.JNR_DEV}, "start");
}
@Override

View File

@ -13,7 +13,7 @@ public class StopCommand extends CommandBase<ArcadeManager>
{
public StopCommand(ArcadeManager plugin)
{
super(plugin, Rank.ADMIN, new Rank[] {Rank.MAPLEAD}, "stop");
super(plugin, Rank.ADMIN, new Rank[] {Rank.MAPLEAD, Rank.JNR_DEV}, "stop");
}
@Override

View File

@ -7,6 +7,7 @@ import java.util.Iterator;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -41,6 +42,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
@ -91,6 +93,9 @@ public class Bridge extends TeamGame implements OreObsfucation
private ArrayList<Location> _lavaBridge = new ArrayList<Location>();
private ArrayList<Location> _lavaSource = new ArrayList<Location>();
//Lilly Pad Bridge
private ArrayList<Location> _lillyPads = new ArrayList<Location>();
private HashSet<BridgePart> _bridgeParts = new HashSet<BridgePart>();
//Animals
@ -236,6 +241,7 @@ public class Bridge extends TeamGame implements OreObsfucation
Announce(F.main(C.cWhite + C.Bold + "WARNING", C.cRed + C.Bold + "Water is very hot/cold and will hurt you!"));
}
//parse
@Override
public void ParseData()
{
@ -245,6 +251,7 @@ public class Bridge extends TeamGame implements OreObsfucation
ParseLavaBridge();
ParseWoodBridge();
ParseIceBridge();
ParseLillyPad();
ParseChests();
@ -641,6 +648,11 @@ public class Bridge extends TeamGame implements OreObsfucation
_iceForm = WorldData.GetCustomLocs("WATER_HEIGHT").get(0).getBlockY();
}
private void ParseLillyPad()
{
_lillyPads = WorldData.GetDataLocs("LIME");
}
@EventHandler
public void BridgeBuild(UpdateEvent event)
@ -673,6 +685,7 @@ public class Bridge extends TeamGame implements OreObsfucation
BuildWood();
BuildLava();
BuildIce();
BuildLillyPad();
}
private void BuildIce()
@ -762,6 +775,26 @@ public class Bridge extends TeamGame implements OreObsfucation
0.5f + (float) Math.random());
}
}
private void BuildLillyPad()
{
for (int i = 0; i < 2; i++)
if (_lillyPads != null && !_lillyPads.isEmpty())
{
// Random Block
Location bestLoc = _lillyPads.get(UtilMath.r(_lillyPads.size()));
if (bestLoc.getBlock().getRelative(BlockFace.DOWN).isLiquid())
continue;
_lillyPads.remove(bestLoc);
MapUtil.QuickChangeBlockAt(bestLoc, Material.WATER_LILY);
// Sound
bestLoc.getWorld().playEffect(bestLoc, Effect.STEP_SOUND, 111);
}
}
private void BuildWood()
{

View File

@ -69,6 +69,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.shop.item.SalesPackageBase;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.visibility.VisibilityManager;
import nautilus.game.arcade.game.games.event.kits.*;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -159,11 +160,7 @@ public class EventGame extends SoloGame
GetKits()[0].ApplyKit(player);
//Refresh
for (Player other : UtilServer.getPlayers())
{
other.hidePlayer(player);
other.showPlayer(player);
}
VisibilityManager.Instance.refreshPlayerToAll(player);
//Spawn
GetTeamList().get(0).SpawnTeleport(player);

View File

@ -76,7 +76,7 @@ public class Micro extends TeamGame
{
Block block = WorldData.World.getBlockAt(x, y, z);
if (block.getType() == Material.AIR)
if (block.getType() == Material.AIR || block.isLiquid())
continue;
_blocks.add(block);
@ -104,9 +104,18 @@ public class Micro extends TeamGame
if (_blocks.isEmpty())
return;
if (!UtilTime.elapsed(GetStateTime(), 12000))
return;
int d = 1;
if (UtilTime.elapsed(GetStateTime(), 16000))
d = 2;
if (UtilTime.elapsed(GetStateTime(), 20000))
d = 3;
//TimingManager.start("Block Fall");
for (int i = 0 ; i < 3 ; i++)
for (int i = 0 ; i < d ; i++)
{
Block bestBlock = null;
double bestDist = 0;
@ -133,7 +142,7 @@ public class Micro extends TeamGame
if (Math.random() > 0.75)
bestBlock.getWorld().spawnFallingBlock(bestBlock.getLocation().add(0.5, 0.5, 0.5), bestBlock.getType(), bestBlock.getData());
bestBlock.setType(Material.AIR);
MapUtil.QuickChangeBlockAt(bestBlock.getLocation(), Material.AIR);
}
}

View File

@ -1369,9 +1369,9 @@ public class MineStrike extends TeamGame
public boolean hitHead(Player player, Location loc)
{
return UtilMath.offset2d(loc, player.getLocation()) < 0.3 && //0.3 is ideal
return UtilMath.offset2d(loc, player.getLocation()) < 0.2 && //0.3 was old value, too large
loc.getY() >= player.getEyeLocation().getY() - 0.1 &&
loc.getY() < player.getEyeLocation().getY() + 0.2;
loc.getY() < player.getEyeLocation().getY() + 0.1; //0.2 was old value, too large
}