Хостинг серверов Minecraft playvds.com
  1. Вы находитесь в русском сообществе Bukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на русский язык плагины наших собратьев из других стран.
    Скрыть объявление

Помогите Запись выполнения определенных команд в лог файл.

Тема в разделе "Разработка плагинов для новичков", создана пользователем Skykingcst, 1 янв 2017.

  1. Автор темы
    Skykingcst

    Skykingcst Активный участник Пользователь

    Баллы:
    78
    Skype:
    ghwdonat
    Имя в Minecraft:
    Shapex
    Здравствуйте! По названию темы, понятно, что я хочу, но так-же нужно, сделать там координаты, ник игрока и время(как сделать координаты и время, я знаю, но как сделать записать определенных команд не знаю).
    Заранее спасибо.
     
  2. Хостинг MineCraft
    <
  3. Lilian_solo

    Lilian_solo Новичок Пользователь Заблокирован

    Баллы:
    21
    Имя в Minecraft:
    CoreKolas
    Это же по дефолту есть... Я не совсем понимаю, что тебе нужно, команды уже записываются в лог-файл.
     
  4. Автор темы
    Skykingcst

    Skykingcst Активный участник Пользователь

    Баллы:
    78
    Skype:
    ghwdonat
    Имя в Minecraft:
    Shapex
    Мне нужно, чтобы выполненные команды, которые от WE, записывались в лог файле, с указанием координат, где они были выполнены и ника игрока, который их выполнил.
     
  5. Lilian_solo

    Lilian_solo Новичок Пользователь Заблокирован

    Баллы:
    21
    Имя в Minecraft:
    CoreKolas
    Может через CommandPreProcessEvent?
     
  6. Автор темы
    Skykingcst

    Skykingcst Активный участник Пользователь

    Баллы:
    78
    Skype:
    ghwdonat
    Имя в Minecraft:
    Shapex
    Не знаю, поэтому и пишу сюда.
     
  7. Lilian_solo

    Lilian_solo Новичок Пользователь Заблокирован

    Баллы:
    21
    Имя в Minecraft:
    CoreKolas
    Секундочку...
    Код:
    
        @EventHandler(priority=EventPriority.LOWEST)
        public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
        {
          Player player = event.getPlayer();
          String name = player.getName();
          String command = event.getMessage();
          Location location = player.getLocation();
          int xLocation = (int)location.getX();
          int yLocation = (int)location.getY();
          int zLocation = (int)location.getZ();
          World world = location.getWorld();
          String ipAddress = player.getAddress().getAddress().getHostAddress();
          String worldName = world.getName();
          long time = world.getTime();
      
          Log.info(player, name, command, xLocation, yLocation, zLocation, worldName, time, ipAddress);
        }
    С вас любой подарок =)
    Ну или бесплатно бери, если тебе жалко мне что-то дать =(
    Код:
     if(event.getMessage().equalsIgnoreCase("//wand")) {
                Log.info(player, name, command, xLocation, yLocation, zLocation, worldName, time, ipAddress);
            }
     
  8. Fenix78563

    Fenix78563 Активный участник Пользователь

    Баллы:
    76
    Имя в Minecraft:
    Blc_Dragon
    ЕЕЕЕ, костыльдроч

    и в WE и в WG УЖЕ ЕСТЬ ТАКОЕ

    Так это выглядит в WE, в wg это не далеко, ctrl+f в помощь
    Код:
    logging:
        log-commands: false
        file: worldedit.log
    upload_2017-1-1_22-37-5.png

    Сия строка сохранится и в лог сервера и в тот файл из конфига. прежде чем бежать пилить костыли изучаем конфиг внимательно
     
  9. Автор темы
    Skykingcst

    Skykingcst Активный участник Пользователь

    Баллы:
    78
    Skype:
    ghwdonat
    Имя в Minecraft:
    Shapex
    Благодарю!
     
  10. alexandrage

    alexandrage Администратор

    Баллы:
    173
    Skype:
    alexandr0116
    Угадай с 3х раз, где я сетнул :D. Бесполезная хрень.

    [20:52:53] [Server thread/INFO]: zenit issued server command: //wand
    [20:52:53] [Server thread/INFO]: WorldEdit: zenit (in "world"): /wand
    [20:53:13] [Server thread/INFO]: zenit issued server command: //set 1[DOUBLEPOST=1483293540,1483293297][/DOUBLEPOST]
    Код:
                com.sk89q.worldedit.bukkit.selections.Selection sel = we.getSelection(player);
                if (sel instanceof CuboidSelection) {
                    Vector vec1 = sel.getNativeMinimumPoint();
                    Vector vec2 = sel.getNativeMaximumPoint();
    Пруфит.
     
  11. Fenix78563

    Fenix78563 Активный участник Пользователь

    Баллы:
    76
    Имя в Minecraft:
    Blc_Dragon
    чет не понял. У меня ни разу эта функция не сбоила.
     
  12. alexandrage

    alexandrage Администратор

    Баллы:
    173
    Skype:
    alexandr0116
    А ты вандом выдели и твоя консоль об этом ничего не узнает.[DOUBLEPOST=1483298472,1483296957][/DOUBLEPOST]P.s а если вы хотите полный отсчет что сетнул игрок.

    Код:
    package Example;
    
    import com.sk89q.worldedit.Vector;
    import com.sk89q.worldedit.blocks.BaseBlock;
    import com.sk89q.worldedit.extension.platform.Actor;
    import com.sk89q.worldedit.extent.Extent;
    import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
    
    public class WorldEditLogger extends AbstractLoggingExtent {
        private final Actor actor;
        protected WorldEditLogger(Actor actor, Extent extent) {
            super(extent);
            this.actor = actor;
        }
       
        @Override
        protected void onBlockChange(Vector position, BaseBlock newBlock) {
            BaseBlock oldBlock = getBlock(position);
            System.out.println(actor.getName() + " set block @ " + position +
                    " from " + oldBlock + " to " + newBlock);
        }
    }
    Код:
    package Example;
    
    import com.sk89q.worldedit.event.extent.EditSessionEvent;
    import com.sk89q.worldedit.extension.platform.Actor;
    import com.sk89q.worldedit.util.eventbus.Subscribe;
    
    public class WorldEditEventHandler {
        @Subscribe
        public void wrapForLogging(EditSessionEvent event) {
            Actor actor = event.getActor();
            if (actor != null && actor.isPlayer()) {
                event.setExtent(new WorldEditLogger(actor, event.getExtent()));
            }
        }
    }
    WorldEdit.getInstance().getEventBus().register(new WorldEditEventHandler());
     
  13. alexandrage

    alexandrage Администратор

    Баллы:
    173
    Skype:
    alexandr0116
    Код:
    [22:18:57] [Server thread/INFO]: zenit issued server command: //set 5
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:18:57] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit issued server command: /undo
    [22:22:42] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 297.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 297.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 297.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 297.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 297.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 297.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 296.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 296.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 296.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 296.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 296.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 296.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 295.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 295.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 295.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 295.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 295.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 295.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 294.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 294.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 294.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 294.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 294.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:42] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 294.0) from Block{ID:5, Data: 0} to Block{ID:1, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit issued server command: //redo
    [22:22:52] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 294.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 295.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 296.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-292.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-291.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-290.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-289.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-288.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
    [22:22:52] [Server thread/INFO]: zenit set block @ (-287.0, 70.0, 297.0) from Block{ID:1, Data: 0} to Block{ID:5, Data: 0}
     
  14. Автор темы
    Skykingcst

    Skykingcst Активный участник Пользователь

    Баллы:
    78
    Skype:
    ghwdonat
    Имя в Minecraft:
    Shapex
    Работает, но как сделать, чтобы это все в отдельный лог файлы записывалось?
    Я пытаюсь сделать так:
    Код:
        public static void logToFile(String message) {
         try {
           File dataFolder = pl.getDataFolder();
           if(!dataFolder.exists()) { dataFolder.mkdir(); }
           File saveTo = new File(pl.getDataFolder(), "log.txt");
           if (!saveTo.exists()) { saveTo.createNewFile(); }
           FileWriter fw = new FileWriter(saveTo, true);
           PrintWriter pw = new PrintWriter(fw);
           pw.println(message);
           pw.flush();
           pw.close();
         } catch (IOException e) { e.printStackTrace(); }
       }
    Код:
    package ru.shapex.wecontrol;
    
    import com.sk89q.worldedit.Vector;
    import com.sk89q.worldedit.blocks.BaseBlock;
    import com.sk89q.worldedit.extension.platform.Actor;
    import com.sk89q.worldedit.extent.Extent;
    import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
    
    public class WELogger extends AbstractLoggingExtent {
       
        private final Actor actor;
       
        protected WELogger(Actor actor, Extent extent) {
            super(extent);
            this.actor = actor;
        }
      
        @Override
        protected void onBlockChange(Vector position, BaseBlock newBlock) {
            BaseBlock oldBlock = getBlock(position);
            Main.logToFile(actor.getName() + " set block @ " + position + " from " + oldBlock + " to " + newBlock);
        }
    }
    Код:
    package ru.shapex.wecontrol;
    
    import com.sk89q.worldedit.event.extent.EditSessionEvent;
    import com.sk89q.worldedit.extension.platform.Actor;
    import com.sk89q.worldedit.util.eventbus.Subscribe;
    
    public class WEEvent {
       @Subscribe
       public void wrapForLogging(EditSessionEvent event) {
           Actor actor = event.getActor();
           if (actor != null && actor.isPlayer()) {
               event.setExtent(new WELogger(actor, event.getExtent()));
           }
       }
    }
    И когда я пытаюсь сетнуть, выдает ошибку:
    [​IMG]
     
  15. slavik123123123

    slavik123123123 Старожил Пользователь

    Баллы:
    143
    Имя в Minecraft:
    Leymooooooooooo
    как бы we кординаты сохраняет у себя в папке в txt файлике[DOUBLEPOST=1483305525,1483305456][/DOUBLEPOST]
    Код:
    [INFO] WorldEdit: FatherGregory (in "world"): sphere 2 3
    [INFO] WorldEdit: FatherGregory (in "world"): /undo
    [INFO] WorldEdit: DeGirl (in "world"): /expand 10 d - Region: (1813.0, 64.0, -192.0) - (1869.0, 69.0, -139.0)
    [INFO] WorldEdit: DeGirl (in "world"): /expand 10 u - Region: (1813.0, 54.0, -192.0) - (1869.0, 69.0, -139.0)
    [INFO] WorldEdit: dregalik (in "world"): /replace 1 2 - Region: (53.0, 73.0, -61.0) - (82.0, 73.0, -33.0)
    [INFO] WorldEdit: dregalik (in "world"): /replace 3 2 - Region: (53.0, 73.0, -61.0) - (82.0, 73.0, -33.0)
    правда не всё. но /set /paste сохраняет
     
  16. alexandrage

    alexandrage Администратор

    Баллы:
    173
    Skype:
    alexandr0116
    Только выделение командами, сет ванд и прочее нет. И потом, можно выделять и не сетать. Заипесся ковырять лог и думать где именно сетнули. А иначе смысл в логе то, если он явно не указывает на ченж блоков?[DOUBLEPOST=1483308226][/DOUBLEPOST]
    Вот написал тебе с кастомными логфайлами.

    Код:
    package Example;
    
    import java.io.File;
    import java.io.IOException;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    import org.apache.commons.io.FileUtils;
    
    import com.sk89q.worldedit.Vector;
    import com.sk89q.worldedit.blocks.BaseBlock;
    import com.sk89q.worldedit.event.extent.EditSessionEvent;
    import com.sk89q.worldedit.extension.platform.Actor;
    import com.sk89q.worldedit.extent.logging.AbstractLoggingExtent;
    import com.sk89q.worldedit.util.eventbus.Subscribe;
    
    public class WorldEditLogger {
       
        Main plugin;
       
        public WorldEditLogger(Main plugin) {
            this.plugin = plugin;
        }
    
        @Subscribe
        public void wrapForLogging(EditSessionEvent event) {
            final Actor actor = event.getActor();
            if (actor != null && actor.isPlayer()) {    
                event.setExtent(new AbstractLoggingExtent(event.getExtent()) {
                    @Override
                    protected void onBlockChange(Vector position, BaseBlock newBlock) {
                        BaseBlock oldBlock = getBlock(position);
                        try {
                            FileUtils.write(new File(plugin.getDataFolder()+"/"+actor.getName()+"/"+actor.getName()+"-"+datefile()+".log"), date()+actor.getName()+" set block @ "+position+" from "+oldBlock+" to "+newBlock+"\n", true);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        }
       
        private static String date()
        {
            Date now = new Date();
            DateFormat formatter = new SimpleDateFormat("[HH:mm:ss]");
            String s = formatter.format(now)+" ";
            return s;
        }
       
        private static String datefile()
        {
            Date now = new Date();
            DateFormat formatter = new SimpleDateFormat("YYY-MM-DD");
            String s = formatter.format(now)+" ";
            return s;
        }
    }
    WorldEdit.getInstance().getEventBus().register(new WorldEditLogger(this));
     
    Последнее редактирование: 2 янв 2017
  17. Автор темы
    Skykingcst

    Skykingcst Активный участник Пользователь

    Баллы:
    78
    Skype:
    ghwdonat
    Имя в Minecraft:
    Shapex
    Спасибо!
     
  18. slavik123123123

    slavik123123123 Старожил Пользователь

    Баллы:
    143
    Имя в Minecraft:
    Leymooooooooooo
    всмысле? Я же кинул лог. Там есть регоин который изменили.
    В логе от WE. есть кординаты на любые команды в которых нужно выделять територию.
    [INFO] WorldEdit: MainDRY (in "world"): /paste - Position: (-2.0, 76.0, 43.0)
    нету только на всякие smooth, sphere и тд.[DOUBLEPOST=1483309342,1483309209][/DOUBLEPOST][INFO] WorldEdit: FatherGregory (in "world"): /sphere 0 20 - Position: (-1400.0, 6.0, 3067.0)
    [INFO] WorldEdit: Pulse (in "world"): /smooth - Region: (-1852.0, 69.0, 1788.0) - (-1839.0, 70.0, 1848.0)
    [INFO] WorldEdit: StrangerDude (in "world"): /smooth - Region: (-1449.0, 108.0, -1377.0) - (-1432.0, 121.0, -1364.0)
    и даже на них есть.
     
  19. Автор темы
    Skykingcst

    Skykingcst Активный участник Пользователь

    Баллы:
    78
    Skype:
    ghwdonat
    Имя в Minecraft:
    Shapex
    Не поможешь, исправить ошибку?
    Вот код:
    Код:
      private void processPasteCommand(CommandSender sender, Player player, PlayerCommandPreprocessEvent event, String command, CommandContext args) {
        LocalSession session = Main.worldedit.getSession(player);
        com.sk89q.worldedit.LocalPlayer lPlayer = (com.sk89q.worldedit.LocalPlayer)Main.worldedit.wrapCommandSender(sender);
        com.sk89q.worldguard.LocalPlayer wgLPlayer = Main.worldguard.wrapPlayer(player);
        try {
          Selection clipboard = (Selection) session.getClipboard();
          boolean atOrigin = args.hasFlag('o');
          Vector pos = atOrigin ? ((CuboidClipboard) clipboard).getOrigin() : session.getPlacementPosition(lPlayer);
          Vector startPosition = atOrigin ? pos : pos.add(((CuboidClipboard)clipboard).getOffset());
          Vector nextCorner3 = new Vector(clipboard.getWidth() - 1, clipboard.getHeight() - 1, clipboard.getLength() - 1).add(startPosition);
          String p1 = getPlotNameAtLocation(startPosition, wgLPlayer, player.getWorld());
          String p4 = getPlotNameAtLocation(nextCorner3, wgLPlayer, player.getWorld());
          if (areSameStrings(new String[] { p1, p4 })) {
            if ((!checkOwner(startPosition, wgLPlayer, player.getWorld())) || (!checkOwner(nextCorner3, wgLPlayer, player.getWorld()))) {
              Utils.sendMessage(sender, Messages.notAllowed.toString());
              event.setCancelled(true);
            }
          } else {
            Utils.sendMessage(sender, Messages.notAllowed.toString());
            event.setCancelled(true);
            return;
          }
        } catch (EmptyClipboardException localEmptyClipboardException) {}catch (IncompleteRegionException localIncompleteRegionException) {}
      }
    Ошибка:
    [​IMG]
     
  20. Lilian_solo

    Lilian_solo Новичок Пользователь Заблокирован

    Баллы:
    21
    Имя в Minecraft:
    CoreKolas
    ,,,,,
    155 строчку плз
     
  21. alexandrage

    alexandrage Администратор

    Баллы:
    173
    Skype:
    alexandr0116
    CuboidClipboard не кастуется в Selection.
     

Поделиться этой страницей