Merge branches 'develop' and 'feature/report-v2' of github.com:Mineplex-LLC/Minecraft-PC into feature/report-v2

This commit is contained in:
Keir Nellyer 2016-07-18 17:17:11 +01:00
commit 103f31afc1
4 changed files with 55 additions and 61 deletions

View File

@ -73,7 +73,6 @@ import nautilus.game.arcade.command.GameCommand;
import nautilus.game.arcade.command.KitUnlockCommand;
import nautilus.game.arcade.command.RequiredRankCommand;
import nautilus.game.arcade.command.WriteCommand;
import nautilus.game.arcade.command.*;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
@ -91,7 +90,6 @@ import org.bukkit.*;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.block.Chest;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity;
@ -147,7 +145,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
// Managers
private GameCreationManager _gameCreationManager;
private GameGemManager _gameGemManager;
private GameRewardManager _gameRewardManager;
private GameManager _gameManager;
private GameLobbyManager _gameLobbyManager;
private GamePlayerManager _gamePlayerManager;
@ -279,7 +277,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
// Managers
_gameChatManager = new GameChatManager(this);
_gameCreationManager = new GameCreationManager(this);
_gameGemManager = new GameGemManager(this);
_gameRewardManager = new GameRewardManager(this);
_gameManager = new GameManager(this);
_gameLobbyManager = new GameLobbyManager(this, packetHandler);
_gameHostManager = new GameHostManager(this);
@ -510,9 +508,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return _gameManager;
}
public GameGemManager GetGameGemManager()
public GameRewardManager GetGameGemManager()
{
return _gameGemManager;
return _gameRewardManager;
}
public GamePlayerManager GetGamePlayerManager()

View File

@ -41,7 +41,6 @@ import nautilus.game.arcade.game.games.uhc.helpers.ChunkLoadingThread;
import nautilus.game.arcade.game.games.uhc.helpers.WorldGenThread;
import nautilus.game.arcade.game.modules.OreVeinEditorModule;
import nautilus.game.arcade.game.modules.TeamModule;
import nautilus.game.arcade.game.modules.antixray.AntiXrayModule;
import nautilus.game.arcade.game.modules.combatlog.CombatLogModule;
import nautilus.game.arcade.game.modules.combatlog.CombatLogNPC;
import nautilus.game.arcade.kit.Kit;
@ -277,31 +276,6 @@ public class UHC extends TeamGame implements NCPHook
NCPHookManager.addHook(CheckType.ALL, this);
registerModule(new TeamModule());
registerModule(new AntiXrayModule())
.setEnabled(true)
.setUpdateOnDamage(true)
.setAntiTexturePacksAndFreecam(false)
.setUseProximityHider(false)
.setEngineMode(2)
.setInitialRadius(1)
.setUpdateRadius(2)
.setObfuscateBlocks(
Material.GOLD_ORE,
Material.IRON_ORE,
Material.LAPIS_ORE,
Material.DIAMOND_ORE,
Material.REDSTONE_ORE,
Material.GLOWING_REDSTONE_ORE,
Material.EMERALD_ORE
)
.setRandomBlocks(
Material.GOLD_ORE,
Material.IRON_ORE,
Material.LAPIS_ORE,
Material.DIAMOND_ORE,
Material.REDSTONE_ORE,
Material.EMERALD_ORE
);
}
@Override

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.managers;
import java.lang.reflect.Field;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
@ -37,14 +38,17 @@ import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.GemData;
import net.minecraft.server.v1_8_R3.EntityHuman;
public class GameGemManager implements Listener
/**
* This class is used to reward gems and shards at the end of a game, or when players leave the server.
*/
public class GameRewardManager implements Listener
{
ArcadeManager Manager;
boolean DoubleGem = false;
boolean TimeReward = true;
public GameGemManager(ArcadeManager manager)
public GameRewardManager(ArcadeManager manager)
{
Manager = manager;
@ -159,17 +163,22 @@ public class GameGemManager implements Listener
if (gems == null)
return;
int earned = 0;
final int baseGemsEarned;
int gemsToReward;
for (GemData data : gems.values())
earned += (int)data.Gems;
// Calculate the base gems earned in this game
{
int gemsEarned = 0;
if (earned <= 0)
earned = 1;
for (GemData data : gems.values())
gemsEarned += (int) data.Gems;
earned = (int) (earned * gameMult);
if (gemsEarned <= 0)
gemsEarned = 1;
int total = earned;
baseGemsEarned = (int) (gemsEarned * gameMult);
gemsToReward = baseGemsEarned;
}
String oldName = player.getName();
@ -179,27 +188,28 @@ public class GameGemManager implements Listener
System.out.println("Gems for " + Manager.GetClients().Get(player).GetPlayerName());
}
final int baseShards = total;
int shards = baseShards;
// Award players shards equal to base gems, plus booster bonuses.
final int baseShardsEarned = baseGemsEarned;
int shardsToReward = baseShardsEarned;
//Gem Boooster
// Gem Boooster
Booster booster = Manager.getBoosterManager().getActiveBooster();
if (game.GemBoosterEnabled && booster != null)
{
shards += baseShards * booster.getMultiplier();
shardsToReward *= booster.getMultiplier();
}
//Gem Finder
// Gem Finder
if (game.GemHunterEnabled)
{
int gemFinder = Manager.GetAchievement().get(player.getName(), Achievement.GLOBAL_GEM_HUNTER).getLevel();
if (gemFinder > 0)
{
total += (int)(earned * (gemFinder * 0.25));
gemsToReward += (int)(baseGemsEarned * (gemFinder * 0.25));
}
}
//Time Reward
// Time Reward
if (TimeReward)
{
long timeOnline = Utility.currentTimeMillis() - Manager.GetClients().Get(player).getNetworkSessionLoginTime();
@ -211,34 +221,34 @@ public class GameGemManager implements Listener
if (hoursOnline > 5)
hoursOnline = 5;
total += (int)(earned * (hoursOnline * 0.2));
gemsToReward += (int)(baseGemsEarned * (hoursOnline * 0.2));
}
}
if (DoubleGem && game.GemDoubleEnabled)
total += earned;
gemsToReward += baseGemsEarned;
Rank rank = Manager.GetClients().Get(player).GetRank();
int accountId = Manager.GetClients().getAccountId(player);
if (rank == rank.ULTRA)
shards += baseShards * 0.5;
shardsToReward += baseShardsEarned * 0.5;
else if (rank == rank.HERO)
shards += baseShards * 1;
shardsToReward += baseShardsEarned * 1;
else if (rank == rank.LEGEND)
shards += baseShards * 1.5;
shardsToReward += baseShardsEarned * 1.5;
else if (rank.has(Rank.TITAN))
shards += baseShards * 2;
shardsToReward += baseShardsEarned * 2;
Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total);
Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), gemsToReward);
if (accountId != -1)
{
Manager.GetDonation().rewardCoinsUntilSuccess(null, "Earned", player.getName(), accountId, shards);
Manager.GetDonation().rewardCoinsUntilSuccess(null, "Earned", player.getName(), accountId, shardsToReward);
}
//Stats
Manager.GetStatsManager().incrementStat(player, "Global.GemsEarned", total);
Manager.GetStatsManager().incrementStat(player, game.GetName()+".GemsEarned", total);
Manager.GetStatsManager().incrementStat(player, "Global.GemsEarned", gemsToReward);
Manager.GetStatsManager().incrementStat(player, game.GetName()+".GemsEarned", gemsToReward);
if(Manager.GetClients().Get(player).getDisguisedAs() != null)
{
@ -359,7 +369,7 @@ public class GameGemManager implements Listener
totalGems += earnedGems;
}
final int baseShards = totalGems;
final int baseShards = earnedGems;
int shards = baseShards;
double extraMult = 0;

View File

@ -183,6 +183,18 @@ public class ServerUptimeManager implements Listener
GregorianCalendar firstDate = new GregorianCalendar();
GregorianCalendar secondDate = new GregorianCalendar();
if (firstDate.get(GregorianCalendar.DAY_OF_WEEK) == 1)
{
int week = firstDate.get(GregorianCalendar.WEEK_OF_YEAR) - 1;
if (week == 0)
{
week = Calendar.getInstance().getMaximum(Calendar.WEEK_OF_YEAR);
}
firstDate.set(GregorianCalendar.WEEK_OF_YEAR, week);
secondDate.set(GregorianCalendar.WEEK_OF_YEAR, week);
}
int i = 0;
for (String part : pair.split("-"))
{