Пример #1
0
    public Construct exec(Target t, Env environment, Construct... args)
        throws ConfigRuntimeException {
      MCLocation l =
          ObjectGenerator.GetGenerator()
              .location(
                  args[0],
                  environment.GetPlayer() == null ? null : environment.GetPlayer().getWorld(),
                  t);
      if (l.getBlock().isSign()) {
        String line1 = "";
        String line2 = "";
        String line3 = "";
        String line4 = "";
        if (args.length == 2 && args[1] instanceof CArray) {
          CArray ca = (CArray) args[1];
          if (ca.size() >= 1) {
            line1 = ca.get(0, t).val();
          }
          if (ca.size() >= 2) {
            line2 = ca.get(1, t).val();
          }
          if (ca.size() >= 3) {
            line3 = ca.get(2, t).val();
          }
          if (ca.size() >= 4) {
            line4 = ca.get(3, t).val();
          }

        } else {
          if (args.length >= 2) {
            line1 = args[1].val();
          }
          if (args.length >= 3) {
            line2 = args[2].val();
          }
          if (args.length >= 4) {
            line3 = args[3].val();
          }
          if (args.length >= 5) {
            line4 = args[4].val();
          }
        }
        MCSign s = l.getBlock().getSign();
        s.setLine(0, line1);
        s.setLine(1, line2);
        s.setLine(2, line3);
        s.setLine(3, line4);
        return new CVoid(t);
      } else {
        throw new ConfigRuntimeException(
            "The block at the specified location is not a sign", ExceptionType.RangeException, t);
      }
    }
Пример #2
0
 public Construct exec(Target t, Env environment, Construct... args)
     throws ConfigRuntimeException {
   MCLocation l =
       ObjectGenerator.GetGenerator()
           .location(
               args[0],
               environment.GetPlayer() == null ? null : environment.GetPlayer().getWorld(),
               t);
   if (l.getBlock().isSign()) {
     MCSign s = l.getBlock().getSign();
     CString line1 = new CString(s.getLine(0), t);
     CString line2 = new CString(s.getLine(1), t);
     CString line3 = new CString(s.getLine(2), t);
     CString line4 = new CString(s.getLine(3), t);
     return new CArray(t, line1, line2, line3, line4);
   } else {
     throw new ConfigRuntimeException(
         "The block at the specified location is not a sign", ExceptionType.RangeException, t);
   }
 }