Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
7157aaee2b
@ -2,6 +2,7 @@ package mineplex.core.bonuses.commands;
|
|||||||
|
|
||||||
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.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.bonuses.BonusManager;
|
import mineplex.core.bonuses.BonusManager;
|
||||||
@ -12,7 +13,7 @@ public class TicketCommand extends CommandBase<BonusManager>
|
|||||||
{
|
{
|
||||||
public TicketCommand(BonusManager plugin)
|
public TicketCommand(BonusManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.DEVELOPER, "ticket");
|
super(plugin, Rank.ADMIN, "ticket");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -36,16 +37,29 @@ public class TicketCommand extends CommandBase<BonusManager>
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int tickets = Integer.parseInt(ticketString);
|
final int tickets = Integer.parseInt(ticketString);
|
||||||
Plugin.Get(target).setTickets(Plugin.Get(targetName).getTickets() + tickets);
|
int accountId = Plugin.getClientManager().getAccountId(target);
|
||||||
|
Plugin.getRepository().attemptAddTickets(accountId, Plugin.Get(target), tickets, new Callback<Boolean>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(Boolean data)
|
||||||
|
{
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
UtilPlayer.message(caller, F.main("Carl", "You gave " + F.elem(tickets + " Carl Tickets") + " to " + F.name(targetName) + "."));
|
UtilPlayer.message(caller, F.main("Carl", "You gave " + F.elem(tickets + " Carl Tickets") + " to " + F.name(targetName) + "."));
|
||||||
|
|
||||||
if (target != null)
|
if (target != null && !target.equals(caller))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(target, F.main("Carl", F.name(caller.getName()) + " gave you " + F.elem(tickets + " Carl Tickets") + "."));
|
UtilPlayer.message(target, F.main("Carl", F.name(caller.getName()) + " gave you " + F.elem(tickets + " Carl Tickets") + "."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Carl", "Failed to give tickets. Try again later!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Carl", "Invalid Ticket Amount"));
|
UtilPlayer.message(caller, F.main("Carl", "Invalid Ticket Amount"));
|
||||||
|
Loading…
Reference in New Issue
Block a user