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

Skykingcst

Активный участник
Пользователь
Баллы
78
Имя в Minecraft
Shapex
Здравствуйте! По названию темы, понятно, что я хочу, но так-же нужно, сделать там координаты, ник игрока и время(как сделать координаты и время, я знаю, но как сделать записать определенных команд не знаю).
Заранее спасибо.
 
Это же по дефолту есть... Я не совсем понимаю, что тебе нужно, команды уже записываются в лог-файл.
 
Это же по дефолту есть... Я не совсем понимаю, что тебе нужно, команды уже записываются в лог-файл.
Мне нужно, чтобы выполненные команды, которые от WE, записывались в лог файле, с указанием координат, где они были выполнены и ника игрока, который их выполнил.
 
Мне нужно, чтобы выполненные команды, которые от WE, записывались в лог файле, с указанием координат, где они были выполнены и ника игрока, который их выполнил.
Может через CommandPreProcessEvent?
 
Не знаю, поэтому и пишу сюда.
Секундочку...
Java:
    @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);
    }
С вас любой подарок =)
Ну или бесплатно бери, если тебе жалко мне что-то дать =(
Java:
 if(event.getMessage().equalsIgnoreCase("//wand")) {
            Log.info(player, name, command, xLocation, yLocation, zLocation, worldName, time, ipAddress);
        }
 
ЕЕЕЕ, костыльдроч

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

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

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

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

Так это выглядит в WE, в wg это не далеко, ctrl+f в помощь
YAML:
logging:
    log-commands: false
    file: worldedit.log
Посмотреть вложение 44299

Сия строка сохранится и в лог сервера и в тот файл из конфига. прежде чем бежать пилить костыли изучаем конфиг внимательно
Благодарю!
 
ЕЕЕЕ, костыльдроч

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

Так это выглядит в WE, в wg это не далеко, ctrl+f в помощь
YAML:
logging:
    log-commands: false
    file: worldedit.log
Посмотреть вложение 44299

Сия строка сохранится и в лог сервера и в тот файл из конфига. прежде чем бежать пилить костыли изучаем конфиг внимательно
Угадай с 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
Java:
            com.sk89q.worldedit.bukkit.selections.Selection sel = we.getSelection(player);
            if (sel instanceof CuboidSelection) {
                Vector vec1 = sel.getNativeMinimumPoint();
                Vector vec2 = sel.getNativeMaximumPoint();
Пруфит.
 
Угадай с 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
Java:
            com.sk89q.worldedit.bukkit.selections.Selection sel = we.getSelection(player);
            if (sel instanceof CuboidSelection) {
                Vector vec1 = sel.getNativeMinimumPoint();
                Vector vec2 = sel.getNativeMaximumPoint();
Пруфит.
чет не понял. У меня ни разу эта функция не сбоила.
 
чет не понял. У меня ни разу эта функция не сбоила.
А ты вандом выдели и твоя консоль об этом ничего не узнает.
P.s а если вы хотите полный отсчет что сетнул игрок.

Java:
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);
    }
}

Java:
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());
 
Код:
[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}
 
А ты вандом выдели и твоя консоль об этом ничего не узнает.
P.s а если вы хотите полный отсчет что сетнул игрок.

Java:
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);
    }
}

Java:
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());

Работает, но как сделать, чтобы это все в отдельный лог файлы записывалось?
Я пытаюсь сделать так:
Код:
    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()));
       }
   }
}
И когда я пытаюсь сетнуть, выдает ошибку:
AaAuJm.png
 
Код:
[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}
}
как бы we кординаты сохраняет у себя в папке в txt файлике
Код:
[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 сохраняет
 
как бы we кординаты сохраняет у себя в папке в txt файлике
Код:
[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 сохраняет
Только выделение командами, сет ванд и прочее нет. И потом, можно выделять и не сетать. Заипесся ковырять лог и думать где именно сетнули. А иначе смысл в логе то, если он явно не указывает на ченж блоков?
Работает, но как сделать, чтобы это все в отдельный лог файлы записывалось?
Я пытаюсь сделать так:
Код:
    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()));
       }
   }
}
И когда я пытаюсь сетнуть, выдает ошибку:
AaAuJm.png
Вот написал тебе с кастомными логфайлами.

Java:
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));
 
Последнее редактирование:
Только выделение командами, сет ванд и прочее нет. И потом, можно выделять и не сетать. Заипесся ковырять лог и думать где именно сетнули. А иначе смысл в логе то, если он явно не указывает на ченж блоков?

Вот написал тебе с кастомными логфайлами.

Java:
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));
Спасибо!
 
Только выделение командами, сет ванд и прочее нет. И потом, можно выделять и не сетать. Заипесся ковырять лог и думать где именно сетнули. А иначе смысл в логе то, если он явно не указывает на ченж блоков?
всмысле? Я же кинул лог. Там есть регоин который изменили.
Region: (1813.0, 64.0, -192.0) - (1869.0, 69.0, -139.0)
В логе от WE. есть кординаты на любые команды в которых нужно выделять територию.
[INFO] WorldEdit: MainDRY (in "world"): /paste - Position: (-2.0, 76.0, 43.0)
нету только на всякие smooth, sphere и тд.
[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)
и даже на них есть.
 
Не поможешь, исправить ошибку?
Вот код:
Код:
  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) {}
  }
Ошибка:
OzRusQ.png
 
,,,,,
Не поможешь, исправить ошибку?
Вот код:
Код:
  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) {}
  }
Ошибка:
OzRusQ.png
155 строчку плз
 
Назад
Верх