diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java index 78e26274..e44344ac 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java @@ -1,12 +1,12 @@ package me.totalfreedom.totalfreedommod.fun; import java.util.HashSet; -import java.util.List; import java.util.Random; import java.util.Set; import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.util.DepreciationAggregator; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -16,7 +16,6 @@ import org.bukkit.event.player.PlayerMoveEvent; public class Trailer extends FreedomService { - private final Random random = new Random(); private final Set trailPlayers = new HashSet<>(); // player name @@ -60,8 +59,22 @@ public class Trailer extends FreedomService return; } + final Location location = fromBlock.getLocation(); fromBlock.setType(Material.WOOL); DepreciationAggregator.setData_Block(fromBlock, (byte) random.nextInt(16)); + byte data = DepreciationAggregator.getData_Block(fromBlock); + Material material = Material.getMaterial(String.valueOf(fromBlock.getType())); + for (int x = -1; x <= 1; x++) + { + for (int z = -1; z <= 1; z++) + { + final Location trail_pos; + trail_pos = new Location(event.getPlayer().getWorld(), fromBlock.getX() + x, fromBlock.getY(), fromBlock.getZ() + z); + if (trailPlayers.contains(event.getPlayer().getName())) { + plugin.cpb.getCoreProtectAPI().logPlacement(event.getPlayer().getName(), trail_pos, material, data); + } + } + } } public void remove(Player player)