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

This commit is contained in:
Jonathan Williams 2014-11-07 01:27:16 -08:00
commit f0099368d0
23 changed files with 782 additions and 73 deletions

View File

@ -2,6 +2,12 @@ package mineplex.core.achievement;
public enum Achievement
{
GLOBAL_MINEPLEX_LEVEL("Mineplex Level", 20000,
new String[]{"Global.ExpEarned"},
new String[]{"Level up by doing well in games!"},
getExperienceLevels(),
AchievementCategory.GLOBAL),
GLOBAL_GEM_HUNTER("Gem Hunter", 10000,
new String[]{"Global.GemsEarned"},
new String[]{"+1 for every Gem earned in any game."},
@ -582,6 +588,16 @@ public enum Achievement
_category = category;
}
private static int[] getExperienceLevels()
{
int[] levels = new int[200];
for (int i=0 ; i<levels.length ; i++)
levels[i] = 2000 * i;
return levels;
}
public String getName()
{
return _name;

View File

@ -19,8 +19,8 @@ import mineplex.core.stats.StatsManager;
public enum AchievementCategory
{
GLOBAL("Global", null,
new String[] { "GemsEarned", null, "GamesPlayed", "TimeInGame" },
new String[] { "Gems Earned", null, "Games Played", "Time In Game" },
new String[] { "ExpEarned", "GemsEarned", null, "GamesPlayed", "TimeInGame" },
new String[] { "Mineplex Level", "Gems Earned", null, "Games Played", "Time In Game" },
Material.EMERALD, 0, GameCategory.GLOBAL, null),
//Survival

View File

@ -29,6 +29,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
@ -195,11 +196,28 @@ public class AntiHack extends MiniPlugin
public boolean isValid(Player player, boolean groundValid)
{
//Near Other Player
for (Player other : UtilServer.getPlayers())
{
if (player.equals(other))
continue;
if (other.getGameMode() != GameMode.SURVIVAL)
continue;
if (other.getVehicle() != null)
continue;
if (UtilMath.offset(player, other) < 2)
return true;
}
if (player.isFlying() || player.isInsideVehicle() || player.getGameMode() != GameMode.SURVIVAL)
{
return true;
}
//On Ground
if (groundValid)
{
if (UtilEnt.onBlock(player) || player.getLocation().getBlock().getType() != Material.AIR)

View File

@ -125,6 +125,8 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleRain(this));
addGadget(new ParticleHelix(this));
addGadget(new ParticleGreen(this));
addGadget(new ParticleHeart(this));
addGadget(new ParticleFairy(this));
// Music
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));

View File

@ -16,6 +16,7 @@ import org.bukkit.event.player.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -70,7 +71,7 @@ public class MorphVillager extends MorphGadget implements IThrown
}
@EventHandler
public void Audio(PlayerInteractEvent event)
public void skill(PlayerInteractEvent event)
{
Player player = event.getPlayer();
@ -80,6 +81,12 @@ public class MorphVillager extends MorphGadget implements IThrown
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.Gems) < 20)
{
UtilPlayer.message(player, F.main("Gadget", "You do not have enough Gems."));
return;
}
if (!Recharge.Instance.use(player, GetName(), 800, false, false))
return;

View File

@ -0,0 +1,73 @@
package mineplex.core.gadget.gadgets;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleFairy extends ParticleGadget
{
private HashMap<Player, ParticleFairyData> _fairy = new HashMap<Player, ParticleFairyData>();
public ParticleFairy(GadgetManager manager)
{
super(manager, "Flame Fairy", new String[]
{
C.cWhite + "HEY! LISTEN!",
C.cWhite + "HEY! LISTEN!",
C.cWhite + "HEY! LISTEN!",
},
-2,
Material.BLAZE_POWDER, (byte)0);
}
@EventHandler
public void playParticle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
//Launch
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
//Create
if (!_fairy.containsKey(player))
_fairy.put(player, new ParticleFairyData(player));
_fairy.get(player).Update();
}
}
@Override
public void DisableCustom(Player player)
{
if (_active.remove(player))
UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + "."));
clean(player);
}
@EventHandler
public void quit(PlayerQuitEvent event)
{
clean(event.getPlayer());
}
private void clean(Player player)
{
_fairy.remove(player);
}
}

View File

@ -0,0 +1,87 @@
package mineplex.core.gadget.gadgets;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class ParticleFairyData
{
public Player Player;
public Location Fairy;
public Vector Direction;
public Location Target;
public double Speed;
public long IdleTime;
public ParticleFairyData(Player player)
{
Player = player;
Direction = new Vector(1,0,0);
Fairy = player.getEyeLocation();
Target = getNewTarget();
Speed = 0.2;
IdleTime = 0;
}
public void Update()
{
//Update Target
if (UtilMath.offset(Player.getEyeLocation(), Target) > 3 || UtilMath.offset(Fairy, Target) < 1)
Target = getNewTarget();
//Pause?
if (Math.random() > 0.98)
IdleTime = System.currentTimeMillis() + (long)(Math.random() * 3000);
//Speed
if (UtilMath.offset(Player.getEyeLocation(), Fairy) < 3)
{
if (IdleTime > System.currentTimeMillis())
{
Speed = Math.max(0, Speed - 0.005);
}
else
{
Speed = Math.min(0.15, Speed + 0.005);
}
}
else
{
IdleTime = 0;
Speed = Math.min(0.15 + UtilMath.offset(Player.getEyeLocation(), Fairy) * 0.05, Speed + 0.02);
}
//Modify Direction
Direction.add(UtilAlg.getTrajectory(Fairy, Target).multiply(0.15));
if (Direction.length() < 1)
Speed = Speed * Direction.length();
UtilAlg.Normalize(Direction);
//Move
if (UtilMath.offset(Fairy, Target) > 0.1)
Fairy.add(Direction.clone().multiply(Speed));
//Particle
UtilParticle.PlayParticle(ParticleType.FLAME, Fairy, 0, 0, 0, 0, 1);
UtilParticle.PlayParticle(ParticleType.LAVA, Fairy, 0, 0, 0, 0, 1);
//Sound
Fairy.getWorld().playSound(Fairy, Sound.CAT_PURREOW, 0.1f, 3f);
}
private Location getNewTarget()
{
return Player.getEyeLocation().add(Math.random() * 6 - 3, Math.random() * 1.5, Math.random() * 6 - 3);
}
}

View File

@ -40,17 +40,31 @@ public class ParticleGreen extends ParticleGadget
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
{
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(0, 1f, 0), 0f, 0f, 0f, 0, 1);
}
else
{
float x = (float) (Math.sin(player.getTicksLived()/5d) * 1f);
float z = (float) (Math.cos(player.getTicksLived()/5d) * 1f);
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, 1, z), 0f, 0f, 0f, 0, 1);
}
float x = (float) (Math.sin(player.getTicksLived()/7d) * 1f);
float z = (float) (Math.cos(player.getTicksLived()/7d) * 1f);
float y = (float) (Math.cos(player.getTicksLived()/17d) * 1f + 1f);
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1);
// if (Manager.isMoving(player))
// {
// UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(0, 1f, 0), 0f, 0f, 0f, 0, 1);
// }
// else
// {
// float scale = Math.abs((float) (Math.sin(player.getTicksLived()/30d) * 2f)) + 1;
// // float vertical = (float) (Math.cos(player.getTicksLived()/50d) * 1f);
//
// int dir = player.isSneaking() ? 1 : -1;
//
// for (double i=0 ; i<Math.PI * 2 ; i += 0.2)
// {
// double x = Math.sin(i + (dir * player.getTicksLived()/50d)) * (i%(Math.PI/2d));
// double z = Math.cos(i + (dir * player.getTicksLived()/50d)) * (i%(Math.PI/2d));
//
// UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, 1, z), 0f, 0f, 0f, 0, 1);
// }
// }
}
}
}

View File

@ -0,0 +1,129 @@
package mineplex.core.gadget.gadgets;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleHeart extends ParticleGadget {
private HashMap<Player, HashMap<Player, Location>> _target = new HashMap<Player, HashMap<Player, Location>>();
public ParticleHeart(GadgetManager manager)
{
super(manager, "I Heart You", new String[]
{
C.cWhite + "With these particles, you can",
C.cWhite + "show off how much you heart",
C.cWhite + "everyone on Mineplex!",
},
-2,
Material.APPLE, (byte)0);
}
@EventHandler
public void playParticle(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
return;
//Launch
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
if (!_target.containsKey(player))
_target.put(player, new HashMap<Player, Location>());
if (Recharge.Instance.use(player, GetName(), 500, false, false))
{
for (Player other : UtilServer.getPlayers())
{
if (other.equals(player))
continue;
if (other.getGameMode() != GameMode.SURVIVAL)
continue;
if (_target.get(player).containsKey(other))
continue;
if (UtilMath.offset(player, other) > 6)
continue;
_target.get(player).put(other, player.getLocation().add(0, 1, 0));
break;
}
}
if (Manager.isMoving(player))
UtilParticle.PlayParticle(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0f, 0f, 0f, 0, 1);
else
UtilParticle.PlayParticle(ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.5f, 0.5f, 0.5f, 0, 1);
}
//Particle
for (HashMap<Player, Location> heart : _target.values())
{
Iterator<Entry<Player, Location>> heartIterator = heart.entrySet().iterator();
while (heartIterator.hasNext())
{
Entry<Player, Location> entry = heartIterator.next();
entry.getValue().add(UtilAlg.getTrajectory(entry.getValue(), entry.getKey().getEyeLocation()).multiply(0.6));
UtilParticle.PlayParticle(ParticleType.HEART, entry.getValue(), 0, 0, 0, 0, 1);
if (UtilMath.offset(entry.getValue(), entry.getKey().getEyeLocation()) < 0.6)
heartIterator.remove();
}
}
}
@Override
public void DisableCustom(Player player)
{
if (_active.remove(player))
UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + "."));
clean(player);
}
@EventHandler
public void quit(PlayerQuitEvent event)
{
clean(event.getPlayer());
}
private void clean(Player player)
{
_target.remove(player);
for (HashMap<Player, Location> map : _target.values())
map.remove(player);
}
}

View File

@ -170,7 +170,7 @@ public class Punish extends MiniPlugin
}
});
UtilServer.broadcast(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " banned " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + "."));
UtilServer.broadcast(F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " banned " + playerName + " for " + durationString + "."));
}
else
{
@ -178,8 +178,7 @@ public class Punish extends MiniPlugin
System.out.println(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " +
durationString + "."));
UtilServer.broadcast(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " +
durationString + "."));
UtilServer.broadcast(F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + "."));
_repository.LoadPunishClient(playerName, new Callback<PunishClientToken>()
{

View File

@ -269,6 +269,10 @@ public class RewardManager
new ItemStack(Material.REDSTONE), rarity, 10));
addReward(new UnknownPackageReward(this, donationManager, "Emerald Twirl Particles", "Green Ring",
new ItemStack(Material.EMERALD), rarity, 8));
addReward(new UnknownPackageReward(this, donationManager, "Flame Fairy Particles", "Flame Fairy",
new ItemStack(Material.APPLE), rarity, 4));
addReward(new UnknownPackageReward(this, donationManager, "Heart Particles", "I Heart You",
new ItemStack(Material.BLAZE_POWDER), rarity, 2));
}
public void addReward(Reward reward)

View File

@ -44,6 +44,7 @@ import mineplex.core.RankBenefitsGiver9000;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.RetrieveClientInformationEvent;
import mineplex.core.achievement.Achievement;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
@ -103,7 +104,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class HubManager extends MiniClientPlugin<HubClient>
{
// Snowman!
public HubType Type = HubType.Halloween;
public HubType Type = HubType.Normal;
private BlockRestore _blockRestore;
private CoreClientManager _clientManager;
@ -613,6 +614,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
boolean ownsUltra = _donationManager.Get(player.getName()).OwnsUltraPackage();
//Level Prefix
String levelStr = ChatColor.WHITE + "" + _achievementManager.get(player, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel() + " ";
//Rank Prefix
String rankStr = "";
if (rank != Rank.ALL)
@ -630,7 +634,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
event.getRecipients().clear();
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s");
event.setFormat(levelStr + C.cDPurple + C.Bold + "Party " + C.cWhite + C.Bold + "%1$s " + C.cPurple + "%2$s");
for (String name : party.GetPlayers())
{
@ -659,7 +663,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
}
event.setMessage(event.getMessage());
event.setFormat(rankStr + C.cYellow + "%1$s " + C.cWhite + "%2$s");
event.setFormat(levelStr + rankStr + C.cYellow + "%1$s " + C.cWhite + "%2$s");
}
}
}

View File

@ -1,6 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Knight;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.WeakHashMap;
import org.bukkit.entity.Player;
@ -21,7 +23,7 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class Fortitude extends Skill
{
private WeakHashMap<Player, Double> _preHealth = new WeakHashMap<Player, Double>();
private WeakHashMap<Player, Integer> _health = new WeakHashMap<Player, Integer>();
private WeakHashMap<Player, Double> _health = new WeakHashMap<Player, Double>();
private WeakHashMap<Player, Long> _last = new WeakHashMap<Player, Long>();
public Fortitude(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
@ -34,7 +36,7 @@ public class Fortitude extends Skill
"up to #0#1 of the health you lost.",
"",
"You restore health at a rate of",
"1 health per #3.5#-0.5 seconds.",
"1 health per #3#-0.5 seconds.",
"",
"This does not stack, and is reset if",
"you are hit again."
@ -74,7 +76,7 @@ public class Fortitude extends Skill
double diff = _preHealth.remove(damagee) - damagee.getHealth();
_health.put(damagee, Math.min(level,(int)(diff + 0.5)));
_health.put(damagee, Math.min(level, diff));
_last.put(damagee, System.currentTimeMillis());
}
@ -84,33 +86,35 @@ public class Fortitude extends Skill
if (event.getType() != UpdateType.FASTER)
return;
HashSet<Player> remove = new HashSet<Player>();
for (Player cur : _health.keySet())
Iterator<Entry<Player, Double>> healthIterator = _health.entrySet().iterator();
while (healthIterator.hasNext())
{
int level = getLevel(cur);
if (level == 0) continue;
if (UtilTime.elapsed(_last.get(cur), 3500 - (500 * level)))
{
_health.put(cur, _health.get(cur) - 1);
_last.put(cur, System.currentTimeMillis());
if (_health.get(cur) <= 0)
remove.add(cur);
//Heal
UtilPlayer.health(cur, 1);
//Effect
UtilParticle.PlayParticle(ParticleType.HEART, cur.getEyeLocation(), 0, 0.2f, 0, 0, 1);
}
}
for (Player cur : remove)
{
_health.remove(cur);
_last.remove(cur);
Entry<Player, Double> entry = healthIterator.next();
int level = getLevel(entry.getKey());
if (level == 0)
continue;
if (!UtilTime.elapsed(_last.get(entry.getKey()), 3000 - (500 * level)))
continue;
//Work out healing
double toHeal = Math.min(entry.getValue(), 1);
entry.setValue(entry.getValue() - toHeal);
//Heal
UtilPlayer.health(entry.getKey(), toHeal);
//Effect
UtilParticle.PlayParticle(ParticleType.HEART, entry.getKey().getEyeLocation(), 0, 0.2f, 0, 0, 1);
//Finished
if (entry.getValue() <= 0)
healthIterator.remove();
//Last Tick
_last.put(entry.getKey(), System.currentTimeMillis());
}
}

View File

@ -99,6 +99,7 @@ import nautilus.game.arcade.managers.GameChatManager;
import nautilus.game.arcade.managers.GameCreationManager;
import nautilus.game.arcade.managers.GameFlagManager;
import nautilus.game.arcade.managers.GameGemManager;
import nautilus.game.arcade.managers.GameHostManager;
import nautilus.game.arcade.managers.GameLobbyManager;
import nautilus.game.arcade.managers.GameLootManager;
import nautilus.game.arcade.managers.GameManager;
@ -140,6 +141,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private GamePlayerManager _gamePlayerManager;
private GameTournamentManager _gameTournamentManager;
private GameWorldManager _gameWorldManager;
private GameHostManager _gameHostManager;
private ServerStatusManager _serverStatusManager;
private InventoryManager _inventoryManager;
private CosmeticManager _cosmeticManager;
@ -253,6 +255,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_gameGemManager = new GameGemManager(this);
_gameManager = new GameManager(this);
_gameLobbyManager = new GameLobbyManager(this, packetHandler);
_gameHostManager = new GameHostManager(this);
new GameFlagManager(this);
_gamePlayerManager = new GamePlayerManager(this);
new GameAchievementManager(this);
@ -262,7 +265,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_gameWorldManager = new GameWorldManager(this);
new MiscManager(this);
new IdleManager(this);
new HalloweenManager(this);
//new HalloweenManager(this);
_arcadeRepository = new ArcadeRepository(plugin);
// Game Addons
@ -394,6 +397,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _gameCreationManager;
}
public GameHostManager GetGameHostManager()
{
return _gameHostManager;
}
public GameFactory GetGameFactory()
{
return _gameFactory;
@ -499,6 +507,13 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler
public void MessageMOTD(ServerListPingEvent event)
{
//Mineplex Private Servers
if (_gameHostManager.isHostExpired())
{
event.setMotd(ChatColor.RED + "Finished");
return;
}
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName())
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
@ -942,6 +957,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{
return _serverConfig.MaxPlayers;
}
public String GetHost()
{
return _serverConfig.HostName;
}
@EventHandler
public void ObserverQuit(GameStateChangeEvent event)

View File

@ -215,6 +215,8 @@ public abstract class Game implements Listener
public boolean TeamArmorHotbar = false;
public boolean GiveClock = true;
public boolean AllowParticles = true;
public double GemMultiplier = 1;
public boolean GemHunterEnabled = true;
@ -284,6 +286,7 @@ public abstract class Game implements Listener
new KillsStatTracker(this),
new DeathsStatTracker(this),
new AssistsStatTracker(this),
new ExperienceStatTracker(this),
new WinStatTracker(this),
new LoseStatTracker(this),
new DamageDealtStatTracker(this),

View File

@ -12,6 +12,8 @@ public class GameServerConfig
public ArrayList<GameType> GameList = new ArrayList<GameType>();
//Flags
public String HostName = "";
public boolean Tournament = false;
public boolean TournamentPoints = false;

View File

@ -55,6 +55,7 @@ public class ChampionsDominate extends Domination
};
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
this.StrictAntiHack = true;

View File

@ -56,6 +56,7 @@ public class ChampionsTDM extends TeamDeathmatch
};
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
this.StrictAntiHack = true;

View File

@ -479,6 +479,9 @@ public class DragonEscape extends SoloGame
@EventHandler
public void Warp(PlayerInteractEvent event)
{
if (!IsLive())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK &&
event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_AIR)
return;
@ -563,6 +566,19 @@ public class DragonEscape extends SoloGame
UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(6000 - (System.currentTimeMillis() - GetStateTime())) + ".")));
return;
}
for (Player other : GetPlayers(true))
{
if (player.equals(other))
continue;
if (UtilMath.offset(event.getBlock().getLocation().add(0.5, 0.5, 0.5), other.getLocation()) < 1.5 ||
UtilMath.offset(event.getBlock().getLocation().add(0.5, 1, 0.5), other.getLocation()) < 1.5)
{
UtilPlayer.message(player, F.main("Game", "You cannot dig near other players."));
return;
}
}
if (!Recharge.Instance.use(player, "Tunneler", 100, false, false))
return;

View File

@ -1484,24 +1484,4 @@ public class HideSeek extends TeamGame
return ent.getVehicle() != null;
}
@EventHandler
public void UpdateMAC(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetPlayers(true))
for (Player hider : GetPlayers(true))
{
if (player.equals(hider))
continue;
if (!getHiders().HasPlayer(hider))
continue;
if (UtilMath.offset(player, hider) < 2)
AntiHack.Instance.setIgnore(player, 1000);
}
}
}

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.managers;
import java.util.Iterator;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -59,6 +60,13 @@ public class GameChatManager implements Listener
if (Manager.GetGame() != null)
ownsUltra= Manager.GetDonation().Get(sender.getName()).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA");
//Level Prefix
String levelStr = "";
if (!Manager.GetGame().IsLive())
{
levelStr = ChatColor.WHITE + "" + Manager.GetAchievement().get(sender, Achievement.GLOBAL_MINEPLEX_LEVEL).getLevel() + " ";
}
//Rank Prefix
String rankStr = "";
if (rank != Rank.ALL)
@ -68,7 +76,7 @@ public class GameChatManager implements Listener
rankStr = Rank.ULTRA.GetTag(true, true) + " ";
//Base Format
event.setFormat(dead + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s");
event.setFormat(dead + levelStr + rankStr + Manager.GetColor(sender) + "%1$s " + ChatColor.WHITE + "%2$s");
//Public/Private (Not If Player Dead)
if (Manager.GetGame() != null && Manager.GetGame().GetState() == GameState.Live)
@ -84,13 +92,13 @@ public class GameChatManager implements Listener
if (event.getMessage().charAt(0) == '@')
{
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
event.setFormat(C.cWhite + C.Bold + "Team" + " " + dead + levelStr + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
}
//All Chat
else
{
globalMessage = true;
event.setFormat(dead + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
event.setFormat(dead + levelStr + rankStr + team.GetColor() + "%1$s " + C.cWhite + "%2$s");
}
}

View File

@ -0,0 +1,255 @@
package nautilus.game.arcade.managers;
import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class GameHostManager implements Listener
{
ArcadeManager Manager;
private Player _host;
private long _serverStartTime = System.currentTimeMillis();
private long _serverExpireTime = 43200000;
private long _lastOnline = System.currentTimeMillis();
private long _expireTime = 300000;
private HashSet<String> _whitelist = new HashSet<String>();
private HashSet<String> _blacklist = new HashSet<String>();
public GameHostManager(ArcadeManager manager)
{
Manager = manager;
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
}
@EventHandler
public void updateHost(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
//No Host - Not MPS
if (Manager.GetHost() == null || Manager.GetHost().length() == 0)
return;
//Host Update
if (_host != null)
{
giveHostItem();
_lastOnline = System.currentTimeMillis();
}
}
@EventHandler
public void hostJoin(PlayerJoinEvent event)
{
if (Manager.GetHost() == null || Manager.GetHost().length() == 0)
return;
if (Manager.GetHost().equals(event.getPlayer().getName()))
{
System.out.println("Game Host Joined.");
_host = event.getPlayer();
}
}
@EventHandler
public void hostQuit(PlayerQuitEvent event)
{
if (Manager.GetHost() == null || Manager.GetHost().length() == 0)
return;
if (Manager.GetHost().equals(event.getPlayer().getName()))
{
System.out.println("Game Host Quit.");
_host = null;
}
}
public boolean isHostExpired()
{
if (Manager.GetHost() == null || Manager.GetHost().length() == 0)
return false;
return UtilTime.elapsed(_lastOnline, _expireTime) || UtilTime.elapsed(_serverStartTime, _serverExpireTime);
}
private void giveHostItem()
{
if (Manager.GetGame() == null)
return;
if (_host == null)
return;
if (UtilGear.isMat(_host.getInventory().getItem(5), Material.BOOK_AND_QUILL))
return;
_host.getInventory().setItem(5, ItemStackFactory.Instance.CreateStack(Material.BOOK_AND_QUILL, (byte)0, 1, C.cGreen + C.Bold + "/menu"));
}
public HashSet<String> getWhitelist()
{
return _whitelist;
}
public HashSet<String> getBlacklist()
{
return _blacklist;
}
@EventHandler
public void menuCommand(PlayerCommandPreprocessEvent event)
{
if (_host == null || !event.getPlayer().equals(_host))
return;
if (!event.getMessage().toLowerCase().startsWith("/menu"))
return;
openMenu();
}
@EventHandler
public void menuInteract(PlayerInteractEvent event)
{
if (_host == null || !event.getPlayer().equals(_host))
return;
if (!UtilGear.isMat(_host.getItemInHand(), Material.BOOK_AND_QUILL))
return;
openMenu();
}
private void openMenu()
{
if (_host == null)
return;
//XXX OPEN GUI HERE
}
@EventHandler
public void whitelistCommand(PlayerCommandPreprocessEvent event)
{
if (_host == null || !event.getPlayer().equals(_host))
return;
if (!event.getMessage().toLowerCase().startsWith("/whitelist "))
return;
String[] args = event.getMessage().split(" ");
for (int i=1 ; i<args.length ; i++)
{
String name = args[i].toLowerCase();
if (_whitelist.add(name))
{
UtilPlayer.message(event.getPlayer(), F.main("Host", "Added " + F.elem(name) + " to the whitelist."));
}
}
}
@EventHandler
public void setHostDebug(PlayerCommandPreprocessEvent event)
{
if (!event.getPlayer().isOp())
return;
if (!event.getMessage().toLowerCase().startsWith("/sethost "))
return;
Manager.GetServerConfig().HostName = event.getMessage().split(" ")[1];
event.getPlayer().sendMessage("Set host to: " + event.getMessage().split(" ")[1]);
}
public void setGame(GameType type)
{
if (_host == null)
return;
Manager.GetGameCreationManager().SetNextGameType(type);
//End Current
if (Manager.GetGame().GetState() == GameState.Recruit)
{
Manager.GetGame().SetState(GameState.Dead);
Bukkit.broadcastMessage(C.cGreen + C.Bold + _host.getName() + " has changed game to " + type.GetName() + ".");
}
else
{
Bukkit.broadcastMessage(C.cGreen + C.Bold + _host.getName() + " set next game to " + type.GetName() + ".");
}
}
public void startGame()
{
if (_host == null)
return;
Manager.GetGameManager().StateCountdown(Manager.GetGame(), 10, true);
Manager.GetGame().Announce(C.cGreen + C.Bold + _host.getName() + " has started the game.");
}
public void stopGame()
{
if (_host == null)
return;
if (Manager.GetGame() == null)
return;
HandlerList.unregisterAll(Manager.GetGame());
if (Manager.GetGame().GetState() == GameState.End || Manager.GetGame().GetState() == GameState.End)
{
_host.sendMessage("Game is already ending...");
return;
}
else if (Manager.GetGame().GetState() == GameState.Recruit)
{
Manager.GetGame().SetState(GameState.Dead);
}
else
{
Manager.GetGame().SetState(GameState.End);
}
Manager.GetGame().Announce(C.cGreen + C.Bold + _host.getName() + " has stopped the game.");
}
}

View File

@ -0,0 +1,66 @@
package nautilus.game.arcade.stats;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GemData;
public class ExperienceStatTracker extends StatTracker<Game>
{
private long _startTime;
public ExperienceStatTracker(Game game)
{
super(game);
}
@EventHandler
public void onGameStart(GameStateChangeEvent event)
{
if (event.GetState() == Game.GameState.Live)
_startTime = System.currentTimeMillis();
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onGameEnd(GameStateChangeEvent event)
{
if (!event.GetGame().Manager.IsRewardStats() || !event.GetGame().Manager.IsRewardAchievements())
return;
if (event.GetState() == Game.GameState.End)
{
List<Player> winners = getGame().getWinners();
if (winners != null)
{
for (Player player : event.GetGame().GetPlayers(false))
{
//Tally Gems
double gems = 0;
for (GemData gem : event.GetGame().GetGems(player).values())
gems += (int)gem.Gems;
//Game Time
double time = (int) ((System.currentTimeMillis() - _startTime)/60000d);
//Mult
double mult = 1;
if (!winners.contains(player))
mult = 0.5;
//Exp
int expGained = (int)(time*gems*mult);
//Record Global and per Game
addStat(player, "ExpEarned", expGained, false, true);
addStat(player, "ExpEarned", expGained, false, false);
}
}
}
}
}