@@ -880,6 +880,121 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
880880 }
881881 }
882882
883+ @ api (environments = CommandHelperEnvironment .class )
884+ public static class set_world_day extends AbstractFunction {
885+
886+ @ Override
887+ public String getName () {
888+ return "set_world_day" ;
889+ }
890+
891+ @ Override
892+ public Integer [] numArgs () {
893+ return new Integer []{1 , 2 };
894+ }
895+
896+ @ Override
897+ public String docs () {
898+ return "void {[world], day} Set the current day number of a given world" ;
899+ }
900+
901+ @ Override
902+ public Class <? extends CREThrowable >[] thrown () {
903+ return new Class []{CREInvalidWorldException .class };
904+ }
905+
906+ @ Override
907+ public boolean isRestricted () {
908+ return true ;
909+ }
910+
911+ @ Override
912+ public MSVersion since () {
913+ return MSVersion .V3_3_4 ;
914+ }
915+
916+ @ Override
917+ public Boolean runAsync () {
918+ return false ;
919+ }
920+
921+ @ Override
922+ public Mixed exec (Target t , Environment environment , Mixed ... args ) throws ConfigRuntimeException {
923+ MCWorld w = null ;
924+ if (environment .getEnv (CommandHelperEnvironment .class ).GetPlayer () != null ) {
925+ w = environment .getEnv (CommandHelperEnvironment .class ).GetPlayer ().getWorld ();
926+ }
927+ if (args .length == 2 ) {
928+ w = Static .getServer ().getWorld (args [0 ].val ());
929+ }
930+ if (w == null ) {
931+ throw new CREInvalidWorldException ("No world specified" , t );
932+ }
933+
934+ int day = ArgumentValidation .getInt32 ((args .length == 1 ? args [0 ] : args [1 ]), t );
935+ if (day < 0 ) {
936+ throw new CRERangeException ("Day cannot be negative." , t );
937+ }
938+
939+ w .setFullTime ((day * 24000 ) + w .getTime ());
940+ return CVoid .VOID ;
941+ }
942+ }
943+
944+ @ api (environments = CommandHelperEnvironment .class )
945+ public static class get_world_day extends AbstractFunction {
946+
947+ @ Override
948+ public String getName () {
949+ return "get_world_day" ;
950+ }
951+
952+ @ Override
953+ public Integer [] numArgs () {
954+ return new Integer []{0 , 1 };
955+ }
956+
957+ @ Override
958+ public String docs () {
959+ return "int {[world]} Returns the current day number of the specified world" ;
960+ }
961+
962+ @ Override
963+ public Class <? extends CREThrowable >[] thrown () {
964+ return new Class []{CREInvalidWorldException .class };
965+ }
966+
967+ @ Override
968+ public boolean isRestricted () {
969+ return true ;
970+ }
971+
972+ @ Override
973+ public MSVersion since () {
974+ return MSVersion .V3_3_4 ;
975+ }
976+
977+ @ Override
978+ public Boolean runAsync () {
979+ return false ;
980+ }
981+
982+ @ Override
983+ public Mixed exec (Target t , Environment environment , Mixed ... args ) throws ConfigRuntimeException {
984+ MCWorld w = null ;
985+ if (environment .getEnv (CommandHelperEnvironment .class ).GetPlayer () != null ) {
986+ w = environment .getEnv (CommandHelperEnvironment .class ).GetPlayer ().getWorld ();
987+ }
988+ if (args .length == 1 ) {
989+ w = Static .getServer ().getWorld (args [0 ].val ());
990+ }
991+ if (w == null ) {
992+ throw new CREInvalidWorldException ("No world specified" , t );
993+ }
994+ return new CInt ((long ) java .lang .Math .floor (w .getFullTime () / 24000 ), t );
995+ }
996+ }
997+
883998 @ api (environments = {CommandHelperEnvironment .class })
884999 public static class create_world extends AbstractFunction {
8851000
0 commit comments