Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
9033843a31
@ -1,5 +1,6 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
@ -113,6 +114,16 @@ public class UtilAlg
|
||||
return new Vector(vec.getX(), vec.getY(), vec.getZ());
|
||||
}
|
||||
|
||||
public static <T> T Random(Set<T> set)
|
||||
{
|
||||
List<T> list = new ArrayList<T>();
|
||||
|
||||
list.addAll(set);
|
||||
|
||||
return Random(list);
|
||||
}
|
||||
|
||||
|
||||
public static <T> T Random(List<T> list)
|
||||
{
|
||||
if (list.isEmpty())
|
||||
|
@ -1,8 +1,16 @@
|
||||
package mineplex.core.achievement;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/21/2014.
|
||||
@ -11,8 +19,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
new String[] { "GemsEarned" },
|
||||
new String[] { "Gems Earned" },
|
||||
new String[] { "GemsEarned", null, "GamesPlayed", "TimeInGame" },
|
||||
new String[] { "Gems Earned", null, "Games Played", "Time In Game" },
|
||||
Material.EMERALD, 0, GameCategory.GLOBAL),
|
||||
|
||||
//Survival
|
||||
@ -184,6 +192,40 @@ public enum AchievementCategory
|
||||
return _friendlyStatNames;
|
||||
}
|
||||
|
||||
public void addStats(CoreClientManager clientManager, StatsManager statsManager, List<String> lore, Player player, Player target)
|
||||
{
|
||||
addStats(clientManager, statsManager, lore, Integer.MAX_VALUE, player, target);
|
||||
}
|
||||
|
||||
public void addStats(CoreClientManager clientManager, StatsManager statsManager, List<String> lore, int max, Player player, Player target)
|
||||
{
|
||||
PlayerStats stats = statsManager.Get(target);
|
||||
for (int i = 0; i < _statsToDisplay.length && i < max; i++)
|
||||
{
|
||||
// If the stat is null then just display a blank line instead
|
||||
if (_statsToDisplay[i] == null || _friendlyStatNames[i] == null)
|
||||
{
|
||||
lore.add(" ");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip showing Losses, Kills, Deaths for other players
|
||||
if (!clientManager.Get(player).GetRank().Has(Rank.MODERATOR) && !player.equals(target) && (_statsToDisplay[i].contains("Losses") || _statsToDisplay[i].contains("Kills") || _statsToDisplay[i].contains("Deaths") || _statsToDisplay[i].equals("Time In Game") || _statsToDisplay.equals("Games Played")))
|
||||
continue;
|
||||
|
||||
int statNumber = 0;
|
||||
for (String statToPull : _statsToPull)
|
||||
statNumber += stats.getStat(statToPull + "." + _statsToDisplay[i]);
|
||||
|
||||
String statString = C.cWhite + statNumber;
|
||||
// Need to display special for time
|
||||
if (_statsToDisplay[i].equalsIgnoreCase("TimeInGame"))
|
||||
statString = C.cWhite + UtilTime.convertString(statNumber * 1000L, 0, UtilTime.TimeUnit.FIT);
|
||||
|
||||
lore.add(C.cYellow + _friendlyStatNames[i] + ": " + statString);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum GameCategory
|
||||
{
|
||||
GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE;
|
||||
|
@ -19,7 +19,6 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
/**
|
||||
@ -55,7 +54,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add(" ");
|
||||
addStats(category, lore, 2);
|
||||
category.addStats(ClientManager, _statsManager, lore, category == AchievementCategory.GLOBAL ? 5 : 2, Player, _target);
|
||||
lore.add(" ");
|
||||
addAchievements(category, lore, 9);
|
||||
lore.add(" ");
|
||||
@ -81,27 +80,6 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
addArcadeButton();
|
||||
}
|
||||
|
||||
protected void addStats(AchievementCategory category, List<String> lore, int max)
|
||||
{
|
||||
String[] statsToDisplay = category.getStatsToDisplay();
|
||||
String[] friendlyStatNames = category.getFriendlyStatNames();
|
||||
PlayerStats stats = _statsManager.Get(_target);
|
||||
for (int i = 0; i < statsToDisplay.length && i < max; i++)
|
||||
{
|
||||
// Skip showing Losses, Kills, Deaths for other players
|
||||
if ((!Player.equals(_target)) && (statsToDisplay[i].equalsIgnoreCase("Losses") || statsToDisplay[i].contains("Kills") || statsToDisplay[i].contains("Deaths")))
|
||||
continue;
|
||||
|
||||
String statName = statsToDisplay[i];
|
||||
|
||||
int statNumber = 0;
|
||||
for (String statToPull : category.getStatsToPull())
|
||||
statNumber += stats.getStat(statToPull + "." + statName);
|
||||
|
||||
lore.add(C.cYellow + friendlyStatNames[i] + ": " + C.cWhite + statNumber);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addArcadeButton()
|
||||
{
|
||||
ArcadeButton button = new ArcadeButton(Shop, Plugin, _statsManager, DonationManager, ClientManager, _target);
|
||||
|
@ -155,23 +155,8 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
Material material = Material.BOOK;
|
||||
String itemName = C.Bold + _category.getFriendlyName() + " Stats";
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add("");
|
||||
|
||||
PlayerStats stats = _statsManager.Get(_target);
|
||||
String[] statsToDisplay = _category.getStatsToDisplay();
|
||||
String[] friendlyStatNames = _category.getFriendlyStatNames();
|
||||
for (int i = 0; i < statsToDisplay.length; i++)
|
||||
{
|
||||
// Skip showing Losses, Kills, Deaths for other players
|
||||
if ((!Player.equals(_target)) && (statsToDisplay[i].equalsIgnoreCase("Losses") || statsToDisplay[i].contains("Kills") || statsToDisplay[i].contains("Deaths")))
|
||||
continue;
|
||||
|
||||
int statNumber = 0;
|
||||
for (String statToPull : _category.getStatsToPull())
|
||||
statNumber += stats.getStat(statToPull + "." + statsToDisplay[i]);
|
||||
|
||||
lore.add(C.cYellow + friendlyStatNames[i] + ": " + C.cWhite + statNumber);
|
||||
}
|
||||
lore.add(" ");
|
||||
_category.addStats(ClientManager, _statsManager, lore, Player, _target);
|
||||
|
||||
ItemStack item = new ItemStack(material);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
@ -16,7 +16,6 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
/**
|
||||
@ -43,7 +42,7 @@ public class ArcadeMainPage extends AchievementMainPage
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add(" ");
|
||||
addStats(category, lore, 2);
|
||||
category.addStats(ClientManager, _statsManager, lore, 2, Player, _target);
|
||||
lore.add(" ");
|
||||
addAchievements(category, lore, 9);
|
||||
lore.add(" ");
|
||||
|
@ -157,7 +157,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
new WorldManager(this);
|
||||
new JumpManager(this);
|
||||
//new UHCManager(this);
|
||||
new TournamentInviter(this);
|
||||
//new TournamentInviter(this);
|
||||
|
||||
_news = new NewsManager(this);
|
||||
|
||||
|
@ -236,7 +236,8 @@ public abstract class Game implements Listener
|
||||
public int EloStart = 1000;
|
||||
|
||||
public boolean CanAddStats = true;
|
||||
|
||||
public boolean CanGiveLoot = true;
|
||||
|
||||
public ArrayList<String> GemBoosters = new ArrayList<String>();
|
||||
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();
|
||||
|
||||
|
@ -1423,6 +1423,9 @@ public class MineStrike extends TeamGame
|
||||
_bombPlanter = null;
|
||||
_bombHolder = null;
|
||||
|
||||
//Sound
|
||||
playSound(Radio.BOMB_PLANT, null, null);
|
||||
|
||||
//Title
|
||||
UtilTitle.display(null, C.cRed + C.Bold + "Bomb has been planted!", 10, 50, 10);
|
||||
}
|
||||
@ -1527,8 +1530,11 @@ public class MineStrike extends TeamGame
|
||||
_bomb = null;
|
||||
_bombDefuser.setExp(0f);
|
||||
_bombDefuser = null;
|
||||
|
||||
//Sound
|
||||
playSound(Radio.BOMB_DEFUSE, null, null);
|
||||
|
||||
setWinner(GetTeam(ChatColor.AQUA));
|
||||
setWinner(GetTeam(ChatColor.AQUA), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1580,7 +1586,7 @@ public class MineStrike extends TeamGame
|
||||
|
||||
_winText = _bombPlantedBy.getName() + " destroyed the bomb site!";
|
||||
|
||||
setWinner(GetTeam(ChatColor.RED));
|
||||
setWinner(GetTeam(ChatColor.RED), false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1627,7 +1633,7 @@ public class MineStrike extends TeamGame
|
||||
{
|
||||
_winText = "Bomb sites were successfully defended!";
|
||||
drawScoreboard();
|
||||
setWinner(GetTeam(ChatColor.AQUA));
|
||||
setWinner(GetTeam(ChatColor.AQUA), false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1660,24 +1666,24 @@ public class MineStrike extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
setWinner(teamsAlive.get(0));
|
||||
setWinner(teamsAlive.get(0), false);
|
||||
}
|
||||
else if (teamsAlive.size() == 0)
|
||||
{
|
||||
if (_bomb == null)
|
||||
{
|
||||
_winText = "Bomb sites were successfully defended!";
|
||||
setWinner(GetTeam(ChatColor.AQUA));
|
||||
setWinner(GetTeam(ChatColor.AQUA), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_winText = "Bomb site will be destroyed!";
|
||||
setWinner(GetTeam(ChatColor.RED));
|
||||
setWinner(GetTeam(ChatColor.RED), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setWinner(GameTeam winner)
|
||||
public void setWinner(final GameTeam winner, boolean defuse)
|
||||
{
|
||||
if (_roundOver)
|
||||
return;
|
||||
@ -1686,12 +1692,29 @@ public class MineStrike extends TeamGame
|
||||
|
||||
String winnerLine = C.Bold + "The round was a draw!";
|
||||
ChatColor color = ChatColor.GRAY;
|
||||
if (winnerLine != null)
|
||||
if (winner != null)
|
||||
{
|
||||
winnerLine= winner.GetColor() + C.Bold + winner.GetName() + " has won the round!";
|
||||
addScore(winner);
|
||||
drawScoreboard();
|
||||
color = winner.GetColor();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Sound
|
||||
if (winner != null)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (winner.GetColor() == ChatColor.RED)
|
||||
playSound(Radio.T_WIN, null, null);
|
||||
else
|
||||
playSound(Radio.CT_WIN, null, null);
|
||||
}
|
||||
}, defuse ? 60 : 0);
|
||||
}
|
||||
|
||||
//Record Streak for Money
|
||||
@ -1980,6 +2003,10 @@ public class MineStrike extends TeamGame
|
||||
//Give Bomb
|
||||
Player bombPlayer = UtilAlg.Random(GetTeam(ChatColor.RED).GetPlayers(true));
|
||||
giveBombToPlayer(bombPlayer);
|
||||
|
||||
//Sound
|
||||
playSound(Radio.CT_START, null, GetTeam(ChatColor.AQUA));
|
||||
playSound(Radio.T_START, null, GetTeam(ChatColor.RED));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2465,6 +2492,29 @@ public class MineStrike extends TeamGame
|
||||
return _bulletInstant;
|
||||
}
|
||||
|
||||
public void playSound(Radio radio, Player player, GameTeam team)
|
||||
{
|
||||
if (player == null && team == null)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
other.playSound(other.getLocation(), radio.getSound(), 1f, 1f);
|
||||
}
|
||||
else if (team != null)
|
||||
{
|
||||
for (Player other : team.GetPlayers(false))
|
||||
other.playSound(other.getLocation(), radio.getSound(), 1f, 1f);
|
||||
}
|
||||
else if (player != null)
|
||||
{
|
||||
GameTeam playerTeam = GetTeam(player);
|
||||
if (playerTeam == null)
|
||||
return;
|
||||
|
||||
for (Player other : playerTeam.GetPlayers(false))
|
||||
other.playSound(player.getLocation(), radio.getSound(), 1.5f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void joinMessage(PlayerJoinEvent event)
|
||||
{
|
||||
|
@ -0,0 +1,42 @@
|
||||
package nautilus.game.arcade.game.games.minestrike;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public enum Radio
|
||||
{
|
||||
BOMB_PLANT(new Sound[] {Sound.WOLF_PANT}),
|
||||
BOMB_DEFUSE(new Sound[] {Sound.WOLF_SHAKE}),
|
||||
CT_WIN(new Sound[] {Sound.WOLF_WHINE}),
|
||||
T_WIN(new Sound[] {Sound.ZOMBIE_DEATH}),
|
||||
|
||||
CT_GRENADE_HE(new Sound[] {Sound.SPIDER_IDLE}),
|
||||
CT_GRENADE_FLASH(new Sound[] {Sound.ZOMBIE_METAL}),
|
||||
CT_GRENADE_SMOKE(new Sound[] {Sound.WOLF_GROWL}),
|
||||
CT_GRENADE_FIRE(new Sound[] {Sound.WOLF_HOWL}),
|
||||
|
||||
T_GRENADE_HE(new Sound[] {Sound.WITHER_HURT}),
|
||||
T_GRENADE_FLASH(new Sound[] {Sound.WOLF_BARK}),
|
||||
T_GRENADE_SMOKE(new Sound[] {Sound.VILLAGER_IDLE}),
|
||||
T_GRENADE_FIRE(new Sound[] {Sound.WITHER_IDLE}),
|
||||
|
||||
CT_START(new Sound[] {Sound.VILLAGER_HIT}),
|
||||
T_START(new Sound[] {Sound.VILLAGER_HAGGLE}),
|
||||
;
|
||||
|
||||
private Sound[] _sounds;
|
||||
|
||||
Radio(Sound[] sounds)
|
||||
{
|
||||
_sounds = sounds;
|
||||
}
|
||||
|
||||
public Sound getSound()
|
||||
{
|
||||
if (_sounds.length == 1)
|
||||
return _sounds[0];
|
||||
|
||||
return _sounds[UtilMath.r(_sounds.length - 1)];
|
||||
}
|
||||
}
|
@ -7,14 +7,18 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class FireGrenadeBase extends Grenade
|
||||
{
|
||||
@ -83,4 +87,14 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
//Register
|
||||
game.registerIncendiary(loc, System.currentTimeMillis() + (_baseTime*2-4000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
game.playSound(team.GetColor() == ChatColor.RED ? Radio.T_GRENADE_FIRE : Radio.CT_GRENADE_FIRE, player, null);
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,11 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
@ -77,4 +80,14 @@ public class FlashBang extends Grenade
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
game.playSound(team.GetColor() == ChatColor.RED ? Radio.T_GRENADE_FLASH : Radio.CT_GRENADE_FLASH, player, null);
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,9 @@ public abstract class Grenade extends StrikeItem
|
||||
|
||||
game.registerThrownGrenade(ent, this);
|
||||
game.deregisterGrenade(this);
|
||||
|
||||
//Sound
|
||||
playSound(game, player);
|
||||
}
|
||||
|
||||
public boolean update(MineStrike game, Entity ent)
|
||||
@ -197,4 +200,6 @@ public abstract class Grenade extends StrikeItem
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Grenade" + ChatColor.RESET;
|
||||
}
|
||||
|
||||
public abstract void playSound(MineStrike game, Player player);
|
||||
}
|
||||
|
@ -5,8 +5,11 @@ import java.util.HashMap;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -51,4 +54,14 @@ public class HighExplosive extends Grenade
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
game.playSound(team.GetColor() == ChatColor.RED ? Radio.T_GRENADE_HE : Radio.CT_GRENADE_HE, player, null);
|
||||
}
|
||||
}
|
||||
|
@ -2,12 +2,16 @@ package nautilus.game.arcade.game.games.minestrike.items.grenades;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Smoke extends Grenade
|
||||
{
|
||||
@ -39,4 +43,14 @@ public class Smoke extends Grenade
|
||||
|
||||
return ent.getTicksLived() > 360;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
game.playSound(team.GetColor() == ChatColor.RED ? Radio.T_GRENADE_SMOKE : Radio.CT_GRENADE_SMOKE, player, null);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class CZ75 extends Gun
|
||||
12, 1, //Clip Size, Spare Ammo
|
||||
80, 2700, //ROF, Reload Time
|
||||
35, 0.006, 0.77, //Damage, Dropoff, Armor Penetration
|
||||
0, 0.25, //COF Min, COF Max
|
||||
0, 0.2, //COF Min, COF Max
|
||||
0.06, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.IRON_HOE, Sound.ENDERMAN_DEATH);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class Deagle extends Gun
|
||||
7, 5, //Clip Size, Spare Ammo
|
||||
300, 2200, //ROF, Reload Time
|
||||
68, 0.007, 0.85, //Damage, Dropoff, Armor Penetration
|
||||
0, 0.25, //COF Min, COF Max
|
||||
0, 0.2, //COF Min, COF Max
|
||||
0.18, 0.2, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.GOLD_HOE, Sound.BAT_DEATH);
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ public class Glock18 extends Gun
|
||||
20, 6, //Clip Size, Spare Ammo
|
||||
120, 2200, //ROF, Reload Time
|
||||
28, 0.008, 0.47, //Damage, Dropoff, Armor Penetration
|
||||
0, 0.18, //COF Min, COF Max
|
||||
0.07, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
0, 0.12, //COF Min, COF Max
|
||||
0.06, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.STONE_HOE, Sound.BAT_LOOP);
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ public class P2000 extends Gun
|
||||
13, 4, //Clip Size, Spare Ammo
|
||||
130, 2200, //ROF, Reload Time
|
||||
35, 0.008, 0.50, //Damage, Dropoff, Armor Penetration
|
||||
0, 0.18, //COF Min, COF Max
|
||||
0.07, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
0, 0.12, //COF Min, COF Max
|
||||
0.06, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.WOOD_HOE, Sound.GHAST_SCREAM2);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class P250 extends Gun
|
||||
13, 4, //Clip Size, Spare Ammo
|
||||
130, 2200, //ROF, Reload Time
|
||||
35, 0.005, 0.77, //Damage, Dropoff, Armor Penetration
|
||||
0, 0.15, //COF Min, COF Max
|
||||
0, 0.1, //COF Min, COF Max
|
||||
0.06, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.DIAMOND_HOE, Sound.SILVERFISH_KILL);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -58,22 +59,34 @@ public class GameLootManager implements Listener
|
||||
|
||||
//Chest
|
||||
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1,
|
||||
new ItemStack(Material.CHEST), RewardRarity.COMMON, 3));
|
||||
new ItemStack(Material.CHEST), RewardRarity.COMMON, 4));
|
||||
|
||||
//Key
|
||||
_rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1,
|
||||
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 600));
|
||||
new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 1000));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void registerPlayers(GameStateChangeEvent event)
|
||||
{
|
||||
if (!Manager.IsRewardAchievements())
|
||||
if (!Manager.IsRewardItems())
|
||||
return;
|
||||
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
_players.clear();
|
||||
|
||||
int requirement = (int)((double)event.GetGame().Manager.GetPlayerFull() * 0.5d);
|
||||
|
||||
event.GetGame().CanGiveLoot = (double)event.GetGame().GetPlayers(true).size() >= requirement;
|
||||
|
||||
if (!event.GetGame().CanGiveLoot)
|
||||
{
|
||||
event.GetGame().Announce(C.Bold + "Game Loot Disabled. Requires " + requirement + " Players.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : event.GetGame().GetPlayers(true))
|
||||
_players.add(player);
|
||||
|
||||
@ -99,35 +112,46 @@ public class GameLootManager implements Listener
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
int rewardsGiven = 0;
|
||||
|
||||
for (Player player : _players)
|
||||
{
|
||||
giveReward(player);
|
||||
if (giveReward(player, false))
|
||||
rewardsGiven++;
|
||||
}
|
||||
|
||||
if (rewardsGiven == 0 && !_players.isEmpty())
|
||||
{
|
||||
giveReward(UtilAlg.Random(_players), true);
|
||||
}
|
||||
|
||||
_players.clear();
|
||||
}
|
||||
}, 240);
|
||||
//Delay after Achievements
|
||||
}
|
||||
|
||||
public void giveReward(Player player)
|
||||
public boolean giveReward(Player player, boolean force)
|
||||
{
|
||||
double chance = Math.min(0.5, 0.12 + (System.currentTimeMillis() - _startTime)/3600000d);
|
||||
|
||||
if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA))
|
||||
if (!force)
|
||||
{
|
||||
if (Manager.GetClients().Get(player).GetRank().Has(Rank.HERO))
|
||||
double chance = Math.min(0.5, 0.1 + (System.currentTimeMillis() - _startTime)/3600000d);
|
||||
|
||||
if (Manager.GetClients().Get(player).GetRank().Has(Rank.ULTRA))
|
||||
{
|
||||
chance *= 1.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
chance *= 1.25;
|
||||
if (Manager.GetClients().Get(player).GetRank().Has(Rank.HERO))
|
||||
{
|
||||
chance *= 1.4;
|
||||
}
|
||||
else
|
||||
{
|
||||
chance *= 1.2;
|
||||
}
|
||||
}
|
||||
|
||||
if (Math.random() > chance)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math.random() > chance)
|
||||
return;
|
||||
|
||||
Reward reward = _rewardManager.nextReward(player, null, false, false);
|
||||
|
||||
@ -179,6 +203,8 @@ public class GameLootManager implements Listener
|
||||
|
||||
player.getWorld().playSound(player.getEyeLocation().add(0.5, 0.5, 0.5), Sound.ENDERDRAGON_DEATH, 10F, 2.0F);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -191,28 +217,7 @@ public class GameLootManager implements Listener
|
||||
if (event.getMessage().startsWith("/lootdebug"))
|
||||
{
|
||||
event.getPlayer().sendMessage(C.cGreen + C.Bold + "Loot Debug...");
|
||||
giveReward(event.getPlayer());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (event.getMessage().startsWith("/lootdebug100"))
|
||||
{
|
||||
event.getPlayer().sendMessage(C.cGreen + C.Bold + "Loot Debug 100...");
|
||||
|
||||
final Player fPlayer = event.getPlayer();
|
||||
|
||||
for (int i=0 ; i<100 ; i++)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
giveReward(fPlayer);
|
||||
}
|
||||
}, 2 * i);
|
||||
}
|
||||
|
||||
giveReward(event.getPlayer(), true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -121,11 +121,8 @@ public class GameManager implements Listener
|
||||
game.SetCountdown(-1);
|
||||
Manager.GetLobby().DisplayWaiting();
|
||||
}
|
||||
|
||||
if (game.GetCountdown() != -1)
|
||||
StateCountdown(game, -1, false);
|
||||
|
||||
else if (Manager.IsGameAutoStart())
|
||||
|
||||
if (Manager.IsGameAutoStart())
|
||||
{
|
||||
if (UtilServer.getPlayers().length >= Manager.GetPlayerFull())
|
||||
StateCountdown(game, 20, false);
|
||||
@ -133,6 +130,10 @@ public class GameManager implements Listener
|
||||
else if (UtilServer.getPlayers().length >= Manager.GetPlayerMin())
|
||||
StateCountdown(game, 60, false);
|
||||
}
|
||||
else if (game.GetCountdown() != -1)
|
||||
{
|
||||
StateCountdown(game, -1, false);
|
||||
}
|
||||
}
|
||||
else if (game.GetState() == GameState.Prepare)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user