mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Makes Trail loggeable to coreprotect.
This commit is contained in:
parent
9e7c385fef
commit
25ad80be60
@ -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;
|
||||
@ -14,11 +14,15 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
|
||||
public class Trailer extends FreedomService
|
||||
{
|
||||
|
||||
public byte data;
|
||||
|
||||
|
||||
private final Random random = new Random();
|
||||
private final Set<String> trailPlayers = new HashSet<>(); // player name
|
||||
public final Set<String> trailPlayers = new HashSet<>(); // player name
|
||||
|
||||
public Trailer(TotalFreedomMod plugin)
|
||||
{
|
||||
@ -60,8 +64,23 @@ public class Trailer extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
final Location location = fromBlock.getLocation();
|
||||
|
||||
fromBlock.setType(Material.WOOL);
|
||||
DepreciationAggregator.setData_Block(fromBlock, (byte) random.nextInt(16));
|
||||
final 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)
|
||||
|
Loading…
Reference in New Issue
Block a user