Jump to content

Recommended Posts

Posted

Hi all,

 

I was asked, if I'm able to add a tracking to my commands if they were successful or not. The user asked about pumping it into the stats command of mc.

 

Currently I haven't any clue for what he needs such a thing, but I'm always willing to learn. ^^

 

Anyway - which method is able to modify these stats?

 

Currently I've found:

ICommandSender.setCommandStat(CommandResultStats.Type type, int amount)

but I'm not sure if this is the right one?!

 

Kind regards,

Pixtar

Posted (edited)

Mhh .. maybe I did something wrong.

 

I did the following ingame:

/scoreboard objectives add CommandStats dummy
/scoreboard objectives setdisplay sidebar CommandStats
/scoreboard players set Success CommandStats 0
/stats entity Pixtar set SuccessCount Success CommandStats

 

After this I executed the command which should affect SuccessCount via:

sender.setCommandStat( CommandResultStats.Type.SUCCESS_COUNT, 1 ); //sender = ICommandSender

 

.. but nothing changed in the scoreboard. Do I need to cast sender to EntityPlayerMP? :|

 

Any ideas?

 

I tried this one too, without any effect:

CommandResultStats crs = new CommandResultStats();
crs.setCommandStatForSender( server, sender, CommandResultStats.Type.SUCCESS_COUNT, 1 );

 

Edited by Pixtar
Posted

Sorry for replying instead of editing, but maybe I haven't explained it very well.

 

I want to modify the SuccessCount of the scoreboard on my own. Mainly it should work like the following:

 

The following command can by typed:

/examplemod active

 

At night it says: Active

At day it says Inactive

 

If it's active I want to set the SuccessCount to 1; on inactive I want to set it to 0.

 

Currently I think this isn't possible to do within the execute of CommandTreeBase / CommandBase, because later in the event chain MC/Forge detects, that the command was successfully executed and overwrites my previously set number.

 

Any ideas how to ship around this?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.