Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex into alex-ctf
This commit is contained in:
commit
f7dab72e8c
@ -1,8 +1,12 @@
|
|||||||
package mineplex.core.account;
|
package mineplex.core.account;
|
||||||
|
|
||||||
|
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.serverdata.Utility;
|
import mineplex.serverdata.Utility;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CoreClient
|
public class CoreClient
|
||||||
@ -12,8 +16,9 @@ public class CoreClient
|
|||||||
private String _name;
|
private String _name;
|
||||||
private String _disguisedAs;
|
private String _disguisedAs;
|
||||||
private Player _player;
|
private Player _player;
|
||||||
private Rank _rank;
|
private Rank _rank, _lastRank;
|
||||||
private Rank _disguisedRank;
|
private Rank _disguisedRank;
|
||||||
|
private Rank _tempRank, _lastTemp;
|
||||||
private boolean _disguised;
|
private boolean _disguised;
|
||||||
|
|
||||||
public CoreClient(Player player)
|
public CoreClient(Player player)
|
||||||
@ -60,16 +65,57 @@ public class CoreClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Rank GetRank()
|
public Rank GetRank()
|
||||||
|
{
|
||||||
|
return GetRank(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rank GetRank(boolean bypass)
|
||||||
{
|
{
|
||||||
if (_rank == null)
|
if (_rank == null)
|
||||||
_rank = Rank.ALL;
|
_rank = Rank.ALL;
|
||||||
|
|
||||||
return _rank;
|
if (bypass || _tempRank == null)
|
||||||
|
return _rank;
|
||||||
|
else
|
||||||
|
return _tempRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRank(Rank rank)
|
public Rank GetLastRank(boolean temp)
|
||||||
{
|
{
|
||||||
_rank = rank;
|
if (temp)
|
||||||
|
{
|
||||||
|
if ((_lastTemp == null) && (_tempRank == null))
|
||||||
|
{
|
||||||
|
return _rank;
|
||||||
|
}
|
||||||
|
else if (_lastTemp == null)
|
||||||
|
{
|
||||||
|
return _tempRank;
|
||||||
|
}
|
||||||
|
return _lastTemp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_lastRank == null) return _rank;
|
||||||
|
return _lastRank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRank(Rank rank, boolean temp)
|
||||||
|
{
|
||||||
|
if (temp)
|
||||||
|
{
|
||||||
|
if (_lastTemp == null) _lastTemp = rank;
|
||||||
|
else _lastTemp = _tempRank;
|
||||||
|
_lastRank = _rank;
|
||||||
|
_tempRank = rank;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_rank != null) _lastRank = _rank;
|
||||||
|
else _lastRank = rank;
|
||||||
|
_rank = rank;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getNetworkSessionLoginTime()
|
public long getNetworkSessionLoginTime()
|
||||||
@ -111,4 +157,16 @@ public class CoreClient
|
|||||||
{
|
{
|
||||||
_networkSessionLoginTime = loginTime;
|
_networkSessionLoginTime = loginTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetTemp()
|
||||||
|
{
|
||||||
|
if (_tempRank != null)
|
||||||
|
{
|
||||||
|
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(_player, _tempRank, _rank, true);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
_lastTemp = _tempRank;
|
||||||
|
_tempRank = null;
|
||||||
|
UtilPlayer.message(_player, C.cGold + "Your test rank has been reset!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.account.command.TestRank;
|
||||||
import mineplex.core.account.command.UpdateRank;
|
import mineplex.core.account.command.UpdateRank;
|
||||||
import mineplex.core.account.event.ClientUnloadEvent;
|
import mineplex.core.account.event.ClientUnloadEvent;
|
||||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||||
@ -74,6 +75,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
public void addCommands()
|
public void addCommands()
|
||||||
{
|
{
|
||||||
addCommand(new UpdateRank(this));
|
addCommand(new UpdateRank(this));
|
||||||
|
addCommand(new TestRank(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreClient Add(String name)
|
public CoreClient Add(String name)
|
||||||
@ -245,7 +247,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
token = gson.fromJson(response, ClientToken.class);
|
token = gson.fromJson(response, ClientToken.class);
|
||||||
|
|
||||||
CoreClient client = Add(playerName);
|
CoreClient client = Add(playerName);
|
||||||
client.SetRank(Rank.valueOf(token.Rank));
|
client.SetRank(Rank.valueOf(token.Rank), false);
|
||||||
client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName()));
|
client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName()));
|
||||||
|
|
||||||
// JSON sql response
|
// JSON sql response
|
||||||
@ -305,7 +307,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
|
|
||||||
token = gson.fromJson(response, ClientToken.class);
|
token = gson.fromJson(response, ClientToken.class);
|
||||||
|
|
||||||
client.SetRank(Rank.valueOf(token.Rank));
|
client.SetRank(Rank.valueOf(token.Rank), false);
|
||||||
|
|
||||||
// _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString());
|
// _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString());
|
||||||
|
|
||||||
@ -418,7 +420,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
CoreClient client = Get(name);
|
CoreClient client = Get(name);
|
||||||
|
|
||||||
client.SetRank(newRank);
|
client.SetRank(newRank, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, name, uuid, rank, perm);
|
}, name, uuid, rank, perm);
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
package mineplex.core.account.command;
|
||||||
|
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class TestRank extends CommandBase<CoreClientManager>
|
||||||
|
{
|
||||||
|
public TestRank(CoreClientManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ALL, "testRank");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(final Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (!Plugin.Get(caller).GetRank(true).has(Rank.JNR_DEV))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.JNR_DEV.getTag(false, true) + C.cGray + "]."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||||
|
|
||||||
|
if (!testServer)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), F.elem("This command can only be used on test servers!")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args == null)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " MODERATOR"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), "Rank argument missing."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("RESET"))
|
||||||
|
{
|
||||||
|
Plugin.Get(caller).resetTemp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Rank tempRank = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tempRank = Rank.valueOf(args[0].toUpperCase());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plugin.Get(caller).SetRank(tempRank, true);
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), "Your rank has been set to " + tempRank.getTag(false, false) + C.cGray + "!"));
|
||||||
|
UtilPlayer.message(caller, F.main("NOTICE", "This is only to be used for testing purposes. Misuse of this command will result in a demotion."));
|
||||||
|
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(true), Plugin.Get(caller).GetRank(), true);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,35 +4,37 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||||
import mineplex.core.command.CommandBase;
|
import mineplex.core.command.CommandBase;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UUIDFetcher;
|
import mineplex.core.common.util.UUIDFetcher;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class UpdateRank extends CommandBase<CoreClientManager>
|
public class UpdateRank extends CommandBase<CoreClientManager>
|
||||||
{
|
{
|
||||||
public UpdateRank(CoreClientManager plugin)
|
public UpdateRank(CoreClientManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV /*On test servers only*/}, "updateRank");
|
super(plugin, Rank.ADMIN, "updateRank");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Execute(final Player caller, String[] args)
|
public void Execute(final Player caller, String[] args)
|
||||||
{
|
{
|
||||||
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
if (!Plugin.Get(caller).GetRank(true).has(caller, Rank.ADMIN, true))
|
||||||
|
|
||||||
if (Plugin.Get(caller).GetRank() == Rank.JNR_DEV && !testServer)
|
|
||||||
{
|
{
|
||||||
F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.getTag(true, true)) + "s are only permitted to set ranks on test servers!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||||
|
|
||||||
if (args == null)
|
if (args == null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
||||||
@ -93,6 +95,19 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UtilPlayer.isOnline(playerName))
|
||||||
|
{
|
||||||
|
Player p = UtilServer.getServer().getPlayer(playerName);
|
||||||
|
if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true))
|
||||||
|
Plugin.Get(p).resetTemp();
|
||||||
|
|
||||||
|
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true);
|
||||||
|
Plugin.Get(p).SetRank(rank, false);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
UtilPlayer.message(p, F.main(Plugin.getName(), "Your rank has been updated to " + rank.Name + "!"));
|
||||||
|
}
|
||||||
|
|
||||||
UtilPlayer.searchOffline(matches, new Callback<String>()
|
UtilPlayer.searchOffline(matches, new Callback<String>()
|
||||||
{
|
{
|
||||||
public void run(final String target)
|
public void run(final String target)
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
package mineplex.core.account.event;
|
||||||
|
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
public class OnlineRankUpdateEvent extends Event
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private Player _player;
|
||||||
|
private Rank _from, _to;
|
||||||
|
private boolean _temp;
|
||||||
|
|
||||||
|
public OnlineRankUpdateEvent(Player player, Rank from, Rank to, boolean temp)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_from = from;
|
||||||
|
_to = to;
|
||||||
|
_temp = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rank getFrom()
|
||||||
|
{
|
||||||
|
return _from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rank getTo()
|
||||||
|
{
|
||||||
|
return _to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTemporary()
|
||||||
|
{
|
||||||
|
return _temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -229,7 +229,8 @@ public class AccountRepository extends RepositoryBase
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
callback.run(response);
|
if (callback != null)
|
||||||
|
callback.run(response);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -767,6 +767,9 @@ public enum Achievement
|
|||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
private static String[] _colors = { C.cAqua, C.cGreen, C.cDGray, C.cPurple, C.cYellow, C.cGray };
|
||||||
|
private static int _negativeCount = 0;
|
||||||
|
|
||||||
private String _name;
|
private String _name;
|
||||||
private String[] _desc;
|
private String[] _desc;
|
||||||
private String[] _stats;
|
private String[] _stats;
|
||||||
@ -832,7 +835,10 @@ public enum Achievement
|
|||||||
public static String getExperienceString(int level)
|
public static String getExperienceString(int level)
|
||||||
{
|
{
|
||||||
if (level < 0)
|
if (level < 0)
|
||||||
return C.cAqua + level;
|
{
|
||||||
|
_negativeCount++;
|
||||||
|
return _colors[_negativeCount % _colors.length] + level;
|
||||||
|
}
|
||||||
|
|
||||||
if (level < 20)
|
if (level < 20)
|
||||||
return C.cGray + level;
|
return C.cGray + level;
|
||||||
|
@ -41,6 +41,7 @@ import mineplex.core.pet.PetManager;
|
|||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.reward.RewardManager;
|
import mineplex.core.reward.RewardManager;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.database.Tables;
|
import mineplex.database.Tables;
|
||||||
@ -164,7 +165,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
updateOffSet();
|
updateOffSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager)
|
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager)
|
||||||
{
|
{
|
||||||
super("Bonus", plugin);
|
super("Bonus", plugin);
|
||||||
_repository = new BonusRepository(plugin, this, donationManager);
|
_repository = new BonusRepository(plugin, this, donationManager);
|
||||||
@ -173,7 +174,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
_npcManager = npcManager;
|
_npcManager = npcManager;
|
||||||
_hologramManager = hologramManager;
|
_hologramManager = hologramManager;
|
||||||
|
|
||||||
_rewardManager = new RewardManager(clientManager, donationManager, inventoryManager, petManager, statsManager,
|
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager,
|
||||||
100, 250,
|
100, 250,
|
||||||
500, 1000,
|
500, 1000,
|
||||||
4000, 6000,
|
4000, 6000,
|
||||||
|
@ -109,7 +109,7 @@ public class SpinGui extends SimpleGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_rewardData = _reward.giveReward("Carls Spinner", getPlayer());
|
_rewardData = _reward.giveReward(RewardType.SpinnerReal, getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tick()
|
private void tick()
|
||||||
|
@ -20,12 +20,12 @@ public abstract class Reward
|
|||||||
_weight = weight;
|
_weight = weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final RewardData giveReward(String type, Player player)
|
public final RewardData giveReward(RewardType rewardType, Player player)
|
||||||
{
|
{
|
||||||
return giveRewardCustom(player);
|
return giveRewardCustom(player, rewardType);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract RewardData giveRewardCustom(Player player);
|
protected abstract RewardData giveRewardCustom(Player player, RewardType rewardType);
|
||||||
|
|
||||||
public abstract RewardData getFakeRewardData(Player player);
|
public abstract RewardData getFakeRewardData(Player player);
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import mineplex.core.reward.rewards.PetReward;
|
|||||||
import mineplex.core.reward.rewards.RankReward;
|
import mineplex.core.reward.rewards.RankReward;
|
||||||
import mineplex.core.reward.rewards.UnknownPackageReward;
|
import mineplex.core.reward.rewards.UnknownPackageReward;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
import mineplex.core.timing.TimingManager;
|
import mineplex.core.timing.TimingManager;
|
||||||
|
|
||||||
public class RewardManager
|
public class RewardManager
|
||||||
@ -35,10 +36,11 @@ public class RewardManager
|
|||||||
private boolean _carlSpinner;
|
private boolean _carlSpinner;
|
||||||
|
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
|
private ServerStatusManager _statusManager;
|
||||||
|
|
||||||
private boolean _doubleGadgetValue;
|
private boolean _doubleGadgetValue;
|
||||||
|
|
||||||
public RewardManager(CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager,
|
public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager,
|
||||||
int commonValueMin, int commonValueMax,
|
int commonValueMin, int commonValueMax,
|
||||||
int uncommonValueMin, int uncommonValueMax,
|
int uncommonValueMin, int uncommonValueMax,
|
||||||
int rareValueMin, int rareValueMax,
|
int rareValueMin, int rareValueMax,
|
||||||
@ -55,6 +57,7 @@ public class RewardManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
|
_statusManager = statusManager;
|
||||||
|
|
||||||
_doubleGadgetValue = doubleGadgetValue;
|
_doubleGadgetValue = doubleGadgetValue;
|
||||||
_carlSpinner = carlSpinner;
|
_carlSpinner = carlSpinner;
|
||||||
@ -304,6 +307,7 @@ public class RewardManager
|
|||||||
addReward(new UnknownPackageReward(donationManager, "Big Larry Morph", "Big Larry Morph",
|
addReward(new UnknownPackageReward(donationManager, "Big Larry Morph", "Big Larry Morph",
|
||||||
new ItemStack(Material.SLIME_BALL), rarity, 10));
|
new ItemStack(Material.SLIME_BALL), rarity, 10));
|
||||||
|
|
||||||
|
|
||||||
// Particles
|
// Particles
|
||||||
addReward(new UnknownPackageReward(donationManager, "Shadow Walk Particles", "Shadow Walk",
|
addReward(new UnknownPackageReward(donationManager, "Shadow Walk Particles", "Shadow Walk",
|
||||||
new ItemStack(Material.LEATHER_BOOTS), rarity, 33));
|
new ItemStack(Material.LEATHER_BOOTS), rarity, 33));
|
||||||
@ -321,8 +325,6 @@ public class RewardManager
|
|||||||
new ItemStack(Material.APPLE), rarity, 4));
|
new ItemStack(Material.APPLE), rarity, 4));
|
||||||
addReward(new UnknownPackageReward(donationManager, "Heart Particles", "I Heart You",
|
addReward(new UnknownPackageReward(donationManager, "Heart Particles", "I Heart You",
|
||||||
new ItemStack(Material.BLAZE_POWDER), rarity, 2));
|
new ItemStack(Material.BLAZE_POWDER), rarity, 2));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addReward(Reward reward)
|
public void addReward(Reward reward)
|
||||||
@ -388,16 +390,20 @@ public class RewardManager
|
|||||||
{
|
{
|
||||||
RewardRarity rarity = type.generateRarity(requiresUncommon);
|
RewardRarity rarity = type.generateRarity(requiresUncommon);
|
||||||
|
|
||||||
//Dont give Rank Upgrade if already has Legend
|
//Dont give Rank Upgrade if already has Titan
|
||||||
if (rarity == RewardRarity.MYTHICAL)
|
if (rarity == RewardRarity.MYTHICAL)
|
||||||
{
|
{
|
||||||
if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
|
if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN))
|
||||||
|
{
|
||||||
|
return new RankReward(_clientManager, _statusManager, 0, rarity);
|
||||||
|
}
|
||||||
|
else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
|
||||||
{
|
{
|
||||||
rarity = RewardRarity.LEGENDARY;
|
rarity = RewardRarity.LEGENDARY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new RankReward(_clientManager, 0, rarity);
|
return new RankReward(_clientManager, _statusManager, 0, rarity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,6 +433,19 @@ public class RewardManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (possibleRewards.size() == 0)
|
||||||
|
{
|
||||||
|
// go again, ignore excluded
|
||||||
|
for (Reward treasure : treasureList)
|
||||||
|
{
|
||||||
|
if ((player == null || treasure.canGiveReward(player)))
|
||||||
|
{
|
||||||
|
possibleRewards.add(treasure);
|
||||||
|
totalWeight += treasure.getWeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (totalWeight > 0)
|
if (totalWeight > 0)
|
||||||
{
|
{
|
||||||
int weight = _random.nextInt(totalWeight);
|
int weight = _random.nextInt(totalWeight);
|
||||||
|
@ -9,8 +9,8 @@ import mineplex.core.common.util.Callback;
|
|||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.reward.Reward;
|
import mineplex.core.reward.Reward;
|
||||||
import mineplex.core.reward.RewardData;
|
import mineplex.core.reward.RewardData;
|
||||||
import mineplex.core.reward.RewardManager;
|
|
||||||
import mineplex.core.reward.RewardRarity;
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
|
|
||||||
public class CoinReward extends Reward
|
public class CoinReward extends Reward
|
||||||
{
|
{
|
||||||
@ -35,7 +35,7 @@ public class CoinReward extends Reward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RewardData giveRewardCustom(Player player)
|
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||||
{
|
{
|
||||||
int coinsToReward = _random.nextInt(_maxCoinCount - _minCoinCount) + _minCoinCount;
|
int coinsToReward = _random.nextInt(_maxCoinCount - _minCoinCount) + _minCoinCount;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import mineplex.core.reward.Reward;
|
import mineplex.core.reward.Reward;
|
||||||
import mineplex.core.reward.RewardData;
|
import mineplex.core.reward.RewardData;
|
||||||
import mineplex.core.reward.RewardRarity;
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
|
|
||||||
public class ExperienceReward extends Reward
|
public class ExperienceReward extends Reward
|
||||||
@ -29,7 +30,7 @@ public class ExperienceReward extends Reward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RewardData giveRewardCustom(Player player)
|
protected RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||||
{
|
{
|
||||||
int experience = _random.nextInt(_maxExperience - _minExperience) + _minExperience;
|
int experience = _random.nextInt(_maxExperience - _minExperience) + _minExperience;
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import mineplex.core.common.util.Callback;
|
|||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.reward.Reward;
|
import mineplex.core.reward.Reward;
|
||||||
import mineplex.core.reward.RewardData;
|
import mineplex.core.reward.RewardData;
|
||||||
import mineplex.core.reward.RewardManager;
|
|
||||||
import mineplex.core.reward.RewardRarity;
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
|
|
||||||
public class GemReward extends Reward
|
public class GemReward extends Reward
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ public class GemReward extends Reward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RewardData giveRewardCustom(Player player)
|
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||||
{
|
{
|
||||||
int GemsToReward = _random.nextInt(_maxGemCount - _minGemCount) + _minGemCount;
|
int GemsToReward = _random.nextInt(_maxGemCount - _minGemCount) + _minGemCount;
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.reward.Reward;
|
import mineplex.core.reward.Reward;
|
||||||
import mineplex.core.reward.RewardData;
|
import mineplex.core.reward.RewardData;
|
||||||
import mineplex.core.reward.RewardManager;
|
|
||||||
import mineplex.core.reward.RewardRarity;
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by shaun on 14-09-12.
|
* Created by shaun on 14-09-12.
|
||||||
@ -44,7 +44,7 @@ public class InventoryReward extends Reward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RewardData giveRewardCustom(Player player)
|
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||||
{
|
{
|
||||||
int amountToGive;
|
int amountToGive;
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import mineplex.core.pet.PetManager;
|
|||||||
import mineplex.core.pet.repository.token.PetChangeToken;
|
import mineplex.core.pet.repository.token.PetChangeToken;
|
||||||
import mineplex.core.pet.repository.token.PetToken;
|
import mineplex.core.pet.repository.token.PetToken;
|
||||||
import mineplex.core.reward.RewardData;
|
import mineplex.core.reward.RewardData;
|
||||||
import mineplex.core.reward.RewardManager;
|
|
||||||
import mineplex.core.reward.RewardRarity;
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
import mineplex.playerCache.PlayerCache;
|
import mineplex.playerCache.PlayerCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +34,7 @@ public class PetReward extends UnknownPackageReward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RewardData giveRewardCustom(Player player)
|
protected RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||||
{
|
{
|
||||||
PetChangeToken token = new PetChangeToken();
|
PetChangeToken token = new PetChangeToken();
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package mineplex.core.reward.rewards;
|
package mineplex.core.reward.rewards;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -8,36 +8,52 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.UUIDFetcher;
|
|
||||||
import mineplex.core.reward.Reward;
|
import mineplex.core.reward.Reward;
|
||||||
import mineplex.core.reward.RewardData;
|
import mineplex.core.reward.RewardData;
|
||||||
import mineplex.core.reward.RewardRarity;
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
|
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
|
||||||
|
|
||||||
public class RankReward extends Reward
|
public class RankReward extends Reward
|
||||||
{
|
{
|
||||||
|
private Random _random;
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
|
private ServerStatusManager _statusManager;
|
||||||
|
|
||||||
public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity)
|
public RankReward(CoreClientManager clientManager, ServerStatusManager statusManager, int weight, RewardRarity rarity)
|
||||||
{
|
{
|
||||||
super(rarity, weight);
|
super(rarity, weight);
|
||||||
|
|
||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
|
_statusManager = statusManager;
|
||||||
|
_random = new Random();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RewardData giveRewardCustom(Player player)
|
public RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||||
{
|
{
|
||||||
Rank rank = null;
|
Rank rank = null;
|
||||||
if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA;
|
if (_clientManager.Get(player).GetRank() == Rank.ALL) rank = Rank.ULTRA;
|
||||||
else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO;
|
else if (_clientManager.Get(player).GetRank() == Rank.ULTRA) rank = Rank.HERO;
|
||||||
else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND;
|
else if (_clientManager.Get(player).GetRank() == Rank.HERO) rank = Rank.LEGEND;
|
||||||
|
else if (rewardType == RewardType.MythicalChest && _clientManager.Get(player).GetRank() == Rank.LEGEND) rank = Rank.TITAN;
|
||||||
|
|
||||||
|
if (rewardType == RewardType.MythicalChest && _random.nextDouble() < 0.02) // 2 Percent
|
||||||
|
rank = Rank.TITAN;
|
||||||
|
|
||||||
if (rank == null)
|
if (rank == null)
|
||||||
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity());
|
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity());
|
||||||
|
|
||||||
_clientManager.Get(player).SetRank(rank);
|
_clientManager.Get(player).SetRank(rank, false);
|
||||||
_clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true);
|
_clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true);
|
||||||
|
|
||||||
|
if (rank == Rank.TITAN)
|
||||||
|
{
|
||||||
|
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(player.getName(), _statusManager.getCurrentServerName());
|
||||||
|
message.publish();
|
||||||
|
}
|
||||||
|
|
||||||
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
|
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import mineplex.core.donation.DonationManager;
|
|||||||
import mineplex.core.reward.Reward;
|
import mineplex.core.reward.Reward;
|
||||||
import mineplex.core.reward.RewardData;
|
import mineplex.core.reward.RewardData;
|
||||||
import mineplex.core.reward.RewardRarity;
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
|
|
||||||
public class UnknownPackageReward extends Reward
|
public class UnknownPackageReward extends Reward
|
||||||
{
|
{
|
||||||
@ -25,7 +26,7 @@ public class UnknownPackageReward extends Reward
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RewardData giveRewardCustom(Player player)
|
protected RewardData giveRewardCustom(Player player, RewardType rewardType)
|
||||||
{
|
{
|
||||||
DonationManager.PurchaseUnknownSalesPackage(null, player.getName(), DonationManager.getClientManager().Get(player).getAccountId(), _packageName, true, 0, true);
|
DonationManager.PurchaseUnknownSalesPackage(null, player.getName(), DonationManager.getClientManager().Get(player).getAccountId(), _packageName, true, 0, true);
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ public class UnknownPackageReward extends Reward
|
|||||||
{
|
{
|
||||||
if (obj instanceof UnknownPackageReward)
|
if (obj instanceof UnknownPackageReward)
|
||||||
{
|
{
|
||||||
return ((UnknownPackageReward) obj).getPackageName().equals(_packageName);
|
return _packageName.equals(((UnknownPackageReward) obj).getPackageName());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,10 +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.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
@ -13,6 +10,10 @@ import mineplex.core.account.CoreClientManager;
|
|||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.status.ServerStatusManager;
|
import mineplex.core.status.ServerStatusManager;
|
||||||
|
import mineplex.core.titangiveaway.redis.GiveawayMessageHandler;
|
||||||
|
import mineplex.core.titangiveaway.redis.TitanChestGiveawayHandler;
|
||||||
|
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
|
||||||
|
import mineplex.core.titangiveaway.redis.TitanGiveawayMessage;
|
||||||
import mineplex.serverdata.Region;
|
import mineplex.serverdata.Region;
|
||||||
import mineplex.serverdata.commands.ServerCommandManager;
|
import mineplex.serverdata.commands.ServerCommandManager;
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ public class TitanGiveawayManager extends MiniPlugin
|
|||||||
_random = new Random();
|
_random = new Random();
|
||||||
|
|
||||||
ServerCommandManager.getInstance().registerCommandType("TitanGiveawayMessage", TitanGiveawayMessage.class, new GiveawayMessageHandler(plugin));
|
ServerCommandManager.getInstance().registerCommandType("TitanGiveawayMessage", TitanGiveawayMessage.class, new GiveawayMessageHandler(plugin));
|
||||||
|
ServerCommandManager.getInstance().registerCommandType("TitanChestGiveawayMessage", TitanChestGiveawayMessage.class, new TitanChestGiveawayHandler(_statusManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openPumpkin(final Player player, final Runnable onSuccess)
|
public void openPumpkin(final Player player, final Runnable onSuccess)
|
||||||
@ -103,7 +105,7 @@ public class TitanGiveawayManager extends MiniPlugin
|
|||||||
|
|
||||||
private void giveRank(Callback<Rank> callback, Rank rank, Player player)
|
private void giveRank(Callback<Rank> callback, Rank rank, Player player)
|
||||||
{
|
{
|
||||||
_clientManager.Get(player).SetRank(rank);
|
_clientManager.Get(player).SetRank(rank, false);
|
||||||
_clientManager.getRepository().saveRank(callback, player.getName(), player.getUniqueId(), rank, true);
|
_clientManager.getRepository().saveRank(callback, player.getName(), player.getUniqueId(), rank, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package mineplex.core.titangiveaway;
|
package mineplex.core.titangiveaway.redis;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -10,6 +10,7 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTextMiddle;
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.titangiveaway.LightFlicker;
|
||||||
import mineplex.serverdata.commands.CommandCallback;
|
import mineplex.serverdata.commands.CommandCallback;
|
||||||
import mineplex.serverdata.commands.ServerCommand;
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ public class GiveawayMessageHandler implements CommandCallback
|
|||||||
String playerName = message.getPlayerName();
|
String playerName = message.getPlayerName();
|
||||||
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 + " found Titan in a " + C.cRed + "Flaming Pumpkin";
|
||||||
UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, 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);
|
@ -0,0 +1,48 @@
|
|||||||
|
package mineplex.core.titangiveaway.redis;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
|
import mineplex.serverdata.commands.CommandCallback;
|
||||||
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
|
public class TitanChestGiveawayHandler implements CommandCallback
|
||||||
|
{
|
||||||
|
private static final long COOLDOWN = 60000L * 90; // 90 Minutes
|
||||||
|
|
||||||
|
private ServerStatusManager _statusManager;
|
||||||
|
private long _lastTimer;
|
||||||
|
|
||||||
|
public TitanChestGiveawayHandler(ServerStatusManager statusManager)
|
||||||
|
{
|
||||||
|
_statusManager = statusManager;
|
||||||
|
_lastTimer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ServerCommand command)
|
||||||
|
{
|
||||||
|
if (command instanceof TitanChestGiveawayMessage)
|
||||||
|
{
|
||||||
|
TitanChestGiveawayMessage chestCommand = ((TitanChestGiveawayMessage) command);
|
||||||
|
if (chestCommand.getServer().equals(_statusManager.getCurrentServerName()) || System.currentTimeMillis() >= _lastTimer + COOLDOWN)
|
||||||
|
{
|
||||||
|
String chatMessage = C.cRed + chestCommand.getPlayerName() + C.cWhite + " found Titan in a " + C.cRed + "Mythical Chest";
|
||||||
|
UtilTextMiddle.display(C.cDRed + C.Bold + "TITAN", chatMessage, 20, 80, 20, UtilServer.getPlayers());
|
||||||
|
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
player.sendMessage(chatMessage);
|
||||||
|
player.playSound(player.getEyeLocation(), Sound.AMBIENCE_CAVE, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package mineplex.core.titangiveaway.redis;
|
||||||
|
|
||||||
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
|
public class TitanChestGiveawayMessage extends ServerCommand
|
||||||
|
{
|
||||||
|
private String _playerName;
|
||||||
|
private String _server;
|
||||||
|
|
||||||
|
public TitanChestGiveawayMessage(String playerName, String server)
|
||||||
|
{
|
||||||
|
_playerName = playerName;
|
||||||
|
_server = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlayerName()
|
||||||
|
{
|
||||||
|
return _playerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getServer()
|
||||||
|
{
|
||||||
|
return _server;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
// Handled in Command Callback
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package mineplex.core.titangiveaway;
|
package mineplex.core.titangiveaway.redis;
|
||||||
|
|
||||||
import mineplex.serverdata.commands.ServerCommand;
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
@ -25,6 +25,7 @@ import mineplex.core.hologram.HologramManager;
|
|||||||
import mineplex.core.reward.Reward;
|
import mineplex.core.reward.Reward;
|
||||||
import mineplex.core.reward.RewardData;
|
import mineplex.core.reward.RewardData;
|
||||||
import mineplex.core.reward.RewardRarity;
|
import mineplex.core.reward.RewardRarity;
|
||||||
|
import mineplex.core.reward.RewardType;
|
||||||
import mineplex.core.treasure.animation.Animation;
|
import mineplex.core.treasure.animation.Animation;
|
||||||
import mineplex.core.treasure.animation.BlockChangeAnimation;
|
import mineplex.core.treasure.animation.BlockChangeAnimation;
|
||||||
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
import mineplex.core.treasure.animation.ChestOpenAnimation;
|
||||||
@ -56,6 +57,7 @@ public class Treasure
|
|||||||
private int _currentChest;
|
private int _currentChest;
|
||||||
|
|
||||||
private Reward[] _rewards;
|
private Reward[] _rewards;
|
||||||
|
private RewardType _rewardType;
|
||||||
private int _currentReward;
|
private int _currentReward;
|
||||||
|
|
||||||
private boolean _finished;
|
private boolean _finished;
|
||||||
@ -65,14 +67,14 @@ public class Treasure
|
|||||||
|
|
||||||
private HologramManager _hologramManager;
|
private HologramManager _hologramManager;
|
||||||
|
|
||||||
public Treasure(Player player, Reward[] rewards, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager)
|
public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager)
|
||||||
{
|
{
|
||||||
this(player, new Random(), rewards, centerBlock, chestBlocks, treasureType, hologramManager);
|
this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager);
|
||||||
|
|
||||||
_blockRestore = blockRestore;
|
_blockRestore = blockRestore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Treasure(Player player, Random seed, Reward[] rewards, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager)
|
public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager)
|
||||||
{
|
{
|
||||||
_player = player;
|
_player = player;
|
||||||
_random = seed;
|
_random = seed;
|
||||||
@ -85,6 +87,7 @@ public class Treasure
|
|||||||
|
|
||||||
_currentChest = 0;
|
_currentChest = 0;
|
||||||
_currentReward = 0;
|
_currentReward = 0;
|
||||||
|
_rewardType = rewardType;
|
||||||
_rewards = rewards;
|
_rewards = rewards;
|
||||||
|
|
||||||
_chestData = new ChestData[chestBlocks.length];
|
_chestData = new ChestData[chestBlocks.length];
|
||||||
@ -196,7 +199,7 @@ public class Treasure
|
|||||||
if (data != null && !data.isOpened() && _currentReward < _rewards.length)
|
if (data != null && !data.isOpened() && _currentReward < _rewards.length)
|
||||||
{
|
{
|
||||||
Reward reward = _rewards[_currentReward];
|
Reward reward = _rewards[_currentReward];
|
||||||
RewardData rewardData = reward.giveReward("Treasure", _player);
|
RewardData rewardData = reward.giveReward(_rewardType, _player);
|
||||||
_currentReward++;
|
_currentReward++;
|
||||||
|
|
||||||
if (swapList)
|
if (swapList)
|
||||||
@ -296,7 +299,7 @@ public class Treasure
|
|||||||
|
|
||||||
for (int i = _currentReward; i < _rewards.length; i++)
|
for (int i = _currentReward; i < _rewards.length; i++)
|
||||||
{
|
{
|
||||||
_rewards[_currentReward].giveReward("Treasure", _player);
|
_rewards[_currentReward].giveReward(_rewardType, _player);
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentReward = _rewards.length;
|
_currentReward = _rewards.length;
|
||||||
|
@ -107,7 +107,7 @@ public class TreasureLocation implements Listener
|
|||||||
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
|
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
|
||||||
|
|
||||||
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
|
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
|
||||||
Treasure treasure = new Treasure(player, rewards, _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
|
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
|
||||||
_currentTreasure = treasure;
|
_currentTreasure = treasure;
|
||||||
|
|
||||||
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player);
|
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player);
|
||||||
|
@ -21,6 +21,7 @@ import mineplex.core.reward.Reward;
|
|||||||
import mineplex.core.reward.RewardManager;
|
import mineplex.core.reward.RewardManager;
|
||||||
import mineplex.core.reward.RewardType;
|
import mineplex.core.reward.RewardType;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Shaun on 8/27/2014.
|
* Created by Shaun on 8/27/2014.
|
||||||
@ -34,7 +35,7 @@ public class TreasureManager extends MiniPlugin
|
|||||||
private StatsManager _statsManager;
|
private StatsManager _statsManager;
|
||||||
private List<TreasureLocation> _treasureLocations;
|
private List<TreasureLocation> _treasureLocations;
|
||||||
|
|
||||||
public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager)
|
public TreasureManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, BlockRestore blockRestore, HologramManager hologramManager, StatsManager statsManager)
|
||||||
{
|
{
|
||||||
super("Treasure", plugin);
|
super("Treasure", plugin);
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ public class TreasureManager extends MiniPlugin
|
|||||||
_blockRestore = blockRestore;
|
_blockRestore = blockRestore;
|
||||||
_hologramManager = hologramManager;
|
_hologramManager = hologramManager;
|
||||||
_statsManager = statsManager;
|
_statsManager = statsManager;
|
||||||
_rewardManager = new RewardManager(clientManager, donationManager, _inventoryManager, petManager, statsManager,
|
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, _inventoryManager, petManager, statsManager,
|
||||||
100, 250,
|
100, 250,
|
||||||
500, 1000,
|
500, 1000,
|
||||||
4000, 6000,
|
4000, 6000,
|
||||||
|
@ -126,7 +126,7 @@ public class Hub extends JavaPlugin implements IRelation
|
|||||||
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
|
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
|
||||||
|
|
||||||
PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager);
|
PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager);
|
||||||
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish);
|
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish, serverStatusManager);
|
||||||
|
|
||||||
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
|
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ import mineplex.core.preferences.PreferencesManager;
|
|||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
import mineplex.core.punish.Punish;
|
import mineplex.core.punish.Punish;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
import mineplex.core.task.TaskManager;
|
import mineplex.core.task.TaskManager;
|
||||||
import mineplex.core.treasure.TreasureManager;
|
import mineplex.core.treasure.TreasureManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -158,7 +159,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
//Admin
|
//Admin
|
||||||
private boolean _gadgetsEnabled = true;
|
private boolean _gadgetsEnabled = true;
|
||||||
|
|
||||||
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish)
|
public HubManager(JavaPlugin plugin, BlockRestore blockRestore, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, ConditionManager conditionManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager, PreferencesManager preferences, PetManager petManager, PollManager pollManager, StatsManager statsManager, AchievementManager achievementManager, HologramManager hologramManager, NpcManager npcManager, PersonalServerManager personalServerManager, PacketHandler packetHandler, Punish punish, ServerStatusManager serverStatusManager)
|
||||||
{
|
{
|
||||||
super("Hub Manager", plugin);
|
super("Hub Manager", plugin);
|
||||||
|
|
||||||
@ -191,7 +192,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
new BenefitManager(plugin, clientManager, _inventoryManager);
|
new BenefitManager(plugin, clientManager, _inventoryManager);
|
||||||
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager);
|
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin), achievementManager);
|
||||||
|
|
||||||
_treasureManager = new TreasureManager(_plugin, clientManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager);
|
_treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager);
|
||||||
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager);
|
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager);
|
||||||
|
|
||||||
new SoccerManager(this, _gadgetManager);
|
new SoccerManager(this, _gadgetManager);
|
||||||
@ -217,7 +218,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
|
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
|
||||||
|
|
||||||
|
|
||||||
new BonusManager(plugin, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
||||||
|
|
||||||
// _halloweenManager = new HalloweenSpookinessManager(this);
|
// _halloweenManager = new HalloweenSpookinessManager(this);
|
||||||
|
|
||||||
@ -740,6 +741,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
|
|
||||||
//Display Rank
|
//Display Rank
|
||||||
obj.getScore(C.cGold + C.Bold + "Rank").setScore(line--);
|
obj.getScore(C.cGold + C.Bold + "Rank").setScore(line--);
|
||||||
|
//Remove Old
|
||||||
|
player.getScoreboard().resetScores(_clientManager.Get(player).GetLastRank(false).Name);
|
||||||
|
player.getScoreboard().resetScores(_clientManager.Get(player).GetLastRank(true).Name);
|
||||||
|
player.getScoreboard().resetScores("No Rank");
|
||||||
|
//Add New
|
||||||
if (GetClients().Get(player).GetRank().has(Rank.ULTRA))
|
if (GetClients().Get(player).GetRank().has(Rank.ULTRA))
|
||||||
obj.getScore(GetClients().Get(player).GetRank().Name).setScore(line--);
|
obj.getScore(GetClients().Get(player).GetRank().Name).setScore(line--);
|
||||||
else if (GetDonation().Get(player.getName()).OwnsUnknownPackage("SuperSmashMobs ULTRA") ||
|
else if (GetDonation().Get(player.getName()).OwnsUnknownPackage("SuperSmashMobs ULTRA") ||
|
||||||
|
@ -305,7 +305,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
|
|
||||||
new NotificationManager(getPlugin(), clientManager);
|
new NotificationManager(getPlugin(), clientManager);
|
||||||
|
|
||||||
new BonusManager(plugin, clientManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager);
|
||||||
|
|
||||||
//Champions Modules
|
//Champions Modules
|
||||||
_energy = new Energy(plugin);
|
_energy = new Energy(plugin);
|
||||||
@ -822,7 +822,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false))
|
if (_clientManager.Get(event.getPlayer().getName()).GetRank().has(event.getPlayer(), Rank.MODERATOR, false) ||
|
||||||
|
_clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPDEV ||
|
||||||
|
_clientManager.Get(event.getPlayer().getName()).GetRank() == Rank.MAPLEAD)
|
||||||
{
|
{
|
||||||
event.allow();
|
event.allow();
|
||||||
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
event.setResult(PlayerLoginEvent.Result.ALLOWED);
|
||||||
|
@ -1484,6 +1484,9 @@ public class HideSeek extends TeamGame
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void InfestLeave(VehicleExitEvent event)
|
public void InfestLeave(VehicleExitEvent event)
|
||||||
{
|
{
|
||||||
|
if (!IsLive())
|
||||||
|
return;
|
||||||
|
|
||||||
InfestEnd(event.getExited());
|
InfestEnd(event.getExited());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class GameLootManager implements Listener
|
|||||||
|
|
||||||
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||||
|
|
||||||
_rewardManager = new RewardManager(Manager.GetClients(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(),
|
_rewardManager = new RewardManager(Manager.GetClients(), Manager.GetServerStatusManager(), Manager.GetDonation(), Manager.getInventoryManager(), petManager, Manager.GetStatsManager(),
|
||||||
100, 250,
|
100, 250,
|
||||||
500, 1000,
|
500, 1000,
|
||||||
1500, 2500,
|
1500, 2500,
|
||||||
@ -164,7 +164,7 @@ public class GameLootManager implements Listener
|
|||||||
|
|
||||||
Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true);
|
Reward reward = _rewardManager.nextReward(player, null, false, RewardType.GameLoot, true);
|
||||||
|
|
||||||
RewardData rewardData = reward.giveReward("GameLoot", player);
|
RewardData rewardData = reward.giveReward(RewardType.GameLoot, player);
|
||||||
|
|
||||||
String outputName = reward.getRarity().getColor() + rewardData.getFriendlyName();
|
String outputName = reward.getRarity().getColor() + rewardData.getFriendlyName();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user