MassiveCore - Performance improvement for command argument readers.

This commit is contained in:
Olof Larsson 2014-07-31 16:42:47 +02:00
parent 95abbe285c
commit 7ac78aa503
14 changed files with 15 additions and 20 deletions

View File

@ -35,7 +35,7 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
public void innerPerform()
{
// Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(usender));
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(usender));
if (uplayer == null) return;
Boolean newValue = this.arg(1, ARBoolean.get(), !ta.isPlayerIdGranted(uplayer.getId()));

View File

@ -37,7 +37,7 @@ public class CmdFactionsDemote extends FCommand
@Override
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.getFaction() != usenderFaction)

View File

@ -42,7 +42,7 @@ public class CmdFactionsInvite extends FCommand
public void perform()
{
// Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
if (uplayer == null) return;
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(uplayer));

View File

@ -45,7 +45,7 @@ public class CmdFactionsJoin extends FCommand
Faction faction = this.arg(0, ARFaction.get(sender));
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;
Faction uplayerFaction = uplayer.getFaction();

View File

@ -43,7 +43,7 @@ public class CmdFactionsKick extends FCommand
public void perform()
{
// Arg
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender));
if (uplayer == null) return;
// Validate

View File

@ -40,7 +40,7 @@ public class CmdFactionsLeader extends FCommand
@Override
public void perform()
{
UPlayer newLeader = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer newLeader = this.arg(0, ARUPlayer.getAny(sender));
if (newLeader == null) return;
Faction targetFaction = this.arg(1, ARFaction.get(sender), usenderFaction);

View File

@ -53,7 +53,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
Faction from = this.arg(1, ARFaction.get(sender));
if (from == null) return;
UPlayer to = this.arg(2, ARUPlayer.getStartAny(sender));
UPlayer to = this.arg(2, ARUPlayer.getAny(sender));
if (to == null) return;
boolean success = Econ.transferMoney(usender, from, to, amount);

View File

@ -50,7 +50,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
UPlayer from = this.arg(1, ARUPlayer.getStartAny(sender));
UPlayer from = this.arg(1, ARUPlayer.getAny(sender));
if (from == null) return;
Faction to = this.arg(2, ARFaction.get(sender));

View File

@ -34,7 +34,7 @@ public class CmdFactionsOfficer extends FCommand
@Override
public void perform()
{
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
if (you == null) return;
boolean permAny = Perm.OFFICER_ANY.has(sender, false);

View File

@ -39,7 +39,7 @@ public class CmdFactionsPlayer extends FCommand
public void perform()
{
// Args
UPlayer uplayer = this.arg(0, ARUPlayer.getStartAny(sender), usender);
UPlayer uplayer = this.arg(0, ARUPlayer.getAny(sender), usender);
if (uplayer == null) return;
// INFO: Title

View File

@ -58,7 +58,7 @@ public class CmdFactionsPowerBoost extends FCommand
if (doPlayer)
{
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(sender));
UPlayer targetPlayer = this.arg(1, ARUPlayer.getAny(sender));
if (targetPlayer == null) return;
targetPlayer.setPowerBoost(targetPower);

View File

@ -37,7 +37,7 @@ public class CmdFactionsPromote extends FCommand
@Override
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.getFaction() != usenderFaction)

View File

@ -42,7 +42,7 @@ public class CmdFactionsTitle extends FCommand
public void perform()
{
// Args
UPlayer you = this.arg(0, ARUPlayer.getStartAny(sender));
UPlayer you = this.arg(0, ARUPlayer.getAny(sender));
if (you == null) return;
String newTitle = this.argConcatFrom(1, ARString.get(), "");

View File

@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd.arg;
import com.massivecraft.factions.entity.UPlayer;
import com.massivecraft.factions.entity.UPlayerColls;
import com.massivecraft.massivecore.cmd.arg.ARSenderEntity;
import com.massivecraft.massivecore.cmd.arg.ArgReader;
public class ARUPlayer
@ -11,12 +10,8 @@ public class ARUPlayer
// 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> getFullOnline(Object o) { return ARSenderEntity.getFullOnline(UPlayerColls.get().get(o)); }
public static ArgReader<UPlayer> getStartOnline(Object o) { return ARSenderEntity.getStartOnline(UPlayerColls.get().get(o)); }
public static ArgReader<UPlayer> getOnline(Object o) { return UPlayerColls.get().get(o).getAREntity(true); }
}