mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 10:05:59 +00:00
Merge pull request #5 from marcocorriero/patch-2
Makes Trail loggeable to coreprotect.
This commit is contained in:
commit
c5e40bcc13
@ -1,12 +1,12 @@
|
|||||||
package me.totalfreedom.totalfreedommod.fun;
|
package me.totalfreedom.totalfreedommod.fun;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -16,7 +16,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
|
|
||||||
public class Trailer extends FreedomService
|
public class Trailer extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
private final Random random = new Random();
|
private final Random random = new Random();
|
||||||
private final Set<String> trailPlayers = new HashSet<>(); // player name
|
private final Set<String> trailPlayers = new HashSet<>(); // player name
|
||||||
|
|
||||||
@ -60,8 +59,22 @@ public class Trailer extends FreedomService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Location location = fromBlock.getLocation();
|
||||||
fromBlock.setType(Material.WOOL);
|
fromBlock.setType(Material.WOOL);
|
||||||
DepreciationAggregator.setData_Block(fromBlock, (byte) random.nextInt(16));
|
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)
|
public void remove(Player player)
|
||||||
|
Loading…
Reference in New Issue
Block a user