Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • Author

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

  • Author

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.