MassiveCore - Performance improvement for command argument readers.
This commit is contained in:
parent
95abbe285c
commit
7ac78aa503
@ -35,7 +35,7 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
|
|||||||
public void innerPerform()
|
public void innerPerform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(usender));
|
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(usender));
|
||||||
if (uplayer == null) return;
|
if (uplayer == null) return;
|
||||||
|
|
||||||
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId()));
|
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId()));
|
||||||
|
@ -37,7 +37,7 @@ public class CmdFactionsDemote extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(usender));
|
UPlayer you = this.arg(0, ARUPlayer.getAny(usender));
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
if (you.getFaction() != usenderFaction)
|
if (you.getFaction() != usenderFaction)
|
||||||
|
@ -42,7 +42,7 @@ public class CmdFactionsInvite extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
|
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
|
||||||
if (uplayer == null) return;
|
if (uplayer == null) return;
|
||||||
|
|
||||||
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));
|
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));
|
||||||
|
@ -45,7 +45,7 @@ public class CmdFactionsJoin extends FCommand
|
|||||||
Faction faction = this.arg(0, ARFaction.get(sender));
|
Faction faction = this.arg(0, ARFaction.get(sender));
|
||||||
if (faction == null) return;
|
if (faction == null) return;
|
||||||
|
|
||||||
UPlayer uplayer = this.arg(1, ARUPlayer.getStartAny(sender), usender);
|
UPlayer uplayer = this.arg(1, ARUPlayer.getAny(sender), usender);
|
||||||
if (uplayer == null) return;
|
if (uplayer == null) return;
|
||||||
Faction uplayerFaction = uplayer.getFaction();
|
Faction uplayerFaction = uplayer.getFaction();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class CmdFactionsKick extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Arg
|
// Arg
|
||||||
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
|
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
|
||||||
if (uplayer == null) return;
|
if (uplayer == null) return;
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
|
@ -40,7 +40,7 @@ public class CmdFactionsLeader extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender));
|
UPlayer newLeader = this.arg(0, ARUPlayer.getAny(sender));
|
||||||
if (newLeader == null) return;
|
if (newLeader == null) return;
|
||||||
|
|
||||||
Faction targetFaction = this.arg(1, ARFaction.get(sender), usenderFaction);
|
Faction targetFaction = this.arg(1, ARFaction.get(sender), usenderFaction);
|
||||||
|
@ -53,7 +53,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
|
|||||||
Faction from = this.arg(1, ARFaction.get(sender));
|
Faction from = this.arg(1, ARFaction.get(sender));
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
|
UPlayer to = this.arg(2, ARUPlayer.getAny(sender));
|
||||||
if (to == null) return;
|
if (to == null) return;
|
||||||
|
|
||||||
boolean success = Econ.transferMoney(usender, from, to, amount);
|
boolean success = Econ.transferMoney(usender, from, to, amount);
|
||||||
|
@ -50,7 +50,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
|
|||||||
Double amount = this.arg(0, ARDouble.get());
|
Double amount = this.arg(0, ARDouble.get());
|
||||||
if (amount == null) return;
|
if (amount == null) return;
|
||||||
|
|
||||||
UPlayer from = this.arg(1, ARUPlayer.getStartAny(sender));
|
UPlayer from = this.arg(1, ARUPlayer.getAny(sender));
|
||||||
if (from == null) return;
|
if (from == null) return;
|
||||||
|
|
||||||
Faction to = this.arg(2, ARFaction.get(sender));
|
Faction to = this.arg(2, ARFaction.get(sender));
|
||||||
|
@ -34,7 +34,7 @@ public class CmdFactionsOfficer extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
|
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
|
||||||
|
@ -39,7 +39,7 @@ public class CmdFactionsPlayer extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender), usender);
|
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender), usender);
|
||||||
if (uplayer == null) return;
|
if (uplayer == null) return;
|
||||||
|
|
||||||
// INFO: Title
|
// INFO: Title
|
||||||
|
@ -58,7 +58,7 @@ public class CmdFactionsPowerBoost extends FCommand
|
|||||||
|
|
||||||
if (doPlayer)
|
if (doPlayer)
|
||||||
{
|
{
|
||||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(sender));
|
UPlayer targetPlayer = this.arg(1, ARUPlayer.getAny(sender));
|
||||||
if (targetPlayer == null) return;
|
if (targetPlayer == null) return;
|
||||||
|
|
||||||
targetPlayer.setPowerBoost(targetPower);
|
targetPlayer.setPowerBoost(targetPower);
|
||||||
|
@ -37,7 +37,7 @@ public class CmdFactionsPromote extends FCommand
|
|||||||
@Override
|
@Override
|
||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
if (you.getFaction() != usenderFaction)
|
if (you.getFaction() != usenderFaction)
|
||||||
|
@ -42,7 +42,7 @@ public class CmdFactionsTitle extends FCommand
|
|||||||
public void perform()
|
public void perform()
|
||||||
{
|
{
|
||||||
// Args
|
// Args
|
||||||
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
|
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
|
||||||
if (you == null) return;
|
if (you == null) return;
|
||||||
|
|
||||||
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
String newTitle = this.argConcatFrom(1, ARString.get(), "");
|
||||||
|
@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd.arg;
|
|||||||
|
|
||||||
import com.massivecraft.factions.entity.UPlayer;
|
import com.massivecraft.factions.entity.UPlayer;
|
||||||
import com.massivecraft.factions.entity.UPlayerColls;
|
import com.massivecraft.factions.entity.UPlayerColls;
|
||||||
import com.massivecraft.massivecore.cmd.arg.ARSenderEntity;
|
|
||||||
import com.massivecraft.massivecore.cmd.arg.ArgReader;
|
import com.massivecraft.massivecore.cmd.arg.ArgReader;
|
||||||
|
|
||||||
public class ARUPlayer
|
public class ARUPlayer
|
||||||
@ -11,12 +10,8 @@ public class ARUPlayer
|
|||||||
// INSTANCE
|
// INSTANCE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public static ArgReader<UPlayer> getFullAny(Object o) { return ARSenderEntity.getFullAny(UPlayerColls.get().get(o)); }
|
public static ArgReader<UPlayer> getAny(Object o) { return UPlayerColls.get().get(o).getAREntity(); }
|
||||||
|
|
||||||
public static ArgReader<UPlayer> getStartAny(Object o) { return ARSenderEntity.getStartAny(UPlayerColls.get().get(o)); }
|
public static ArgReader<UPlayer> getOnline(Object o) { return UPlayerColls.get().get(o).getAREntity(true); }
|
||||||
|
|
||||||
public static ArgReader<UPlayer> getFullOnline(Object o) { return ARSenderEntity.getFullOnline(UPlayerColls.get().get(o)); }
|
|
||||||
|
|
||||||
public static ArgReader<UPlayer> getStartOnline(Object o) { return ARSenderEntity.getStartOnline(UPlayerColls.get().get(o)); }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user