If the database does not contain the player name for certain blocks, cancel event

Discussion in 'Plugin Development' started by jimbo8, Jan 2, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    jimbo8

    Hi!

    Thanks to CubieX, i finally managed to log blocks and such with SQLite. What i need to do now is how i could check if a block contains the player name. If it does not, then cancel the block place/break event.

    I am using the Sync API for this, if that affects anything.

    http://dev.bukkit.org/bukkit-plugins/sync/
     
  2. Offline

    Nateb1121

    Do you have any code? What do you mean check if a block contains a players name? Like the SQL entry?

    Try a SELECT * WHERE statement. It's very hard to help someone when you have no idea what they're doing.
     
  3. jimbo8 What does your DB look like? Maybe even an ER model if it is complicated?
     
  4. Offline

    jimbo8

    Nateb1121

    Yeah, sorry, should have given some more info :p

    The only code i have is to save and see which person placed and broke which blocks.

    Logging class:
    Code:java
    1. package me.Thomas.MySQL.BlockLog;
    2.  
    3. import java.sql.SQLException;
    4.  
    5. import me.Thomas.mindwork.Mindwork;
    6.  
    7. import org.bukkit.Location;
    8. import org.bukkit.World;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.event.EventHandler;
    11. import org.bukkit.event.Listener;
    12. import org.bukkit.event.block.BlockBreakEvent;
    13. import org.bukkit.event.block.BlockPlaceEvent;
    14.  
    15. public class Blocklog implements Listener{
    16. Mindwork plugin;
    17.  
    18. public Blocklog(Mindwork instance){
    19. plugin = instance;
    20. }
    21. @EventHandler
    22. public void onPlayerBreak(BlockBreakEvent event){
    23. int x = event.getBlock().getX();
    24. int y = event.getBlock().getY();
    25. int z = event.getBlock().getZ();
    26. Player player = event.getPlayer();
    27. World world = player.getWorld();
    28. plugin.sql.initialise();
    29. Location block = event.getBlock().getLocation();
    30. try {
    31. plugin.sql.standardQuery("INSERT INTO blockbreak(brukernavn,blokk,x,y,z,verden) VALUES ('" + event.getPlayer().getName() + "', '" + block + "', '" + x +"', '" + y + "', '" + z + "', '"+ world.getName() + "');");
    32. player.sendMessage("Lagret!"); //debug melding
    33. } catch (SQLException e) {
    34. e.printStackTrace();
    35. }
    36. }
    37. @EventHandler
    38. public void onPlayerBreak(BlockPlaceEvent event){
    39. int x = event.getBlock().getX();
    40. int y = event.getBlock().getY();
    41. int z = event.getBlock().getZ();
    42. Player player = event.getPlayer();
    43. World world = player.getWorld();
    44. plugin.sql.initialise();
    45. Location block = event.getBlock().getLocation();
    46. try {
    47. plugin.sql.standardQuery("INSERT INTO blockplace(brukernavn,blokk,x,y,z,verden) VALUES ('" + event.getPlayer().getName() + "', '" + block + "', '" + x +"', '" + y + "', '" + z + "', '"+ world.getName() + "');");
    48. player.sendMessage("Lagret!"); //debug melding
    49. } catch (SQLException e) {
    50. e.printStackTrace();
    51. }
    52. }
    53.  
    54.  
    55.  
    56. }
    57.  


    ..and the checking

    Code:java
    1. package me.Thomas.MySQL.BlockLog;
    2.  
    3. import java.sql.ResultSet;
    4. import java.sql.SQLException;
    5.  
    6. import me.Thomas.mindwork.Mindwork;
    7.  
    8. import org.bukkit.ChatColor;
    9. import org.bukkit.Material;
    10. import org.bukkit.World;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.event.EventHandler;
    13. import org.bukkit.event.Listener;
    14. import org.bukkit.event.block.Action;
    15. import org.bukkit.event.player.PlayerInteractEvent;
    16.  
    17. public class SjekkBlokkLogg implements Listener{
    18. Mindwork plugin;
    19.  
    20. public SjekkBlokkLogg(Mindwork instance){
    21. plugin = instance;
    22. }
    23.  
    24. @EventHandler
    25. public void sjekkLogg(PlayerInteractEvent event){
    26. Player player = event.getPlayer();
    27. if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
    28. if (player.getItemInHand().getType() == Material.WATCH) {
    29. int x = event.getClickedBlock().getLocation().getBlockX();
    30. int y = event.getClickedBlock().getLocation().getBlockY();
    31. int z = event.getClickedBlock().getLocation().getBlockZ();
    32. World world = player.getWorld();
    33. plugin.sql.initialise();
    34. try {
    35. ResultSet coordset = plugin.sql.sqlQuery("SELECT * FROM blockbreak WHERE verden='" + world.getName() + "' AND x=" + x + " AND y=" + y + " AND z=" + z + ";");
    36. ResultSet playerset = plugin.sql.sqlQuery("SELECT brukernavn FROM blockbreak;");
    37. while(coordset.next()){
    38. player.sendMessage(ChatColor.RED + "Denne blokken ble fjernet av " + playerset.getString("brukernavn") + ". Koordinater: " + "\nX: " + coordset.getString("x") + ", Y: " + coordset.getString("y") + ", Z: " + coordset.getString("z") + "\nVerden: " + coordset.getString("verden"));
    39.  
    40. }
    41.  
    42. coordset.close();
    43. playerset.close();
    44. }
    45. catch (SQLException e) {
    46. e.printStackTrace();
    47. }
    48. }
    49. }
    50. if(event.getAction() == Action.LEFT_CLICK_BLOCK){
    51. if (player.getItemInHand().getType() == Material.WATCH) {
    52. event.setCancelled(true);
    53. int x = event.getClickedBlock().getLocation().getBlockX();
    54. int y = event.getClickedBlock().getLocation().getBlockY();
    55. int z = event.getClickedBlock().getLocation().getBlockZ();
    56. World world = player.getWorld();
    57. plugin.sql.initialise();
    58. try {
    59. ResultSet coordset2 = plugin.sql.sqlQuery("SELECT * FROM blockplace WHERE verden='" + world.getName() + "' AND x=" + x + " AND y=" + y + " AND z=" + z + ";");
    60. ResultSet playerset2 = plugin.sql.sqlQuery("SELECT brukernavn FROM blockplace;");
    61. while(coordset2.next()){
    62. player.sendMessage(ChatColor.RED + "Denne blokken ble plassert av " + playerset2.getString("brukernavn") + ". Koordinater: " + "\nX:" + coordset2.getString("x") + ", Y: " + coordset2.getString("y") + ", Z: " + coordset2.getString("z") + "\nVerden: " + coordset2.getString("verden"));
    63. }
    64. coordset2.close();
    65. playerset2.close();
    66. }
    67. catch (SQLException e) {
    68. e.printStackTrace();
    69. }
    70. }
    71.  
    72. }
    73. }
    74. }
    75.  


    Would maybe something like this work?

    Code:java
    1. ResultSet playerset = plugin.sql.sqlQuery("SELECT * FROM blockplace WHERE '" + player.getName() + "'=brukernavn;");
    2.  


    Also, this is in norwegian.

    Short translation;

    Brukernavn means username, verden means world and that is basically it in this code :p

    Sgt_Tailor

    My database looks like this;
    http://i.imgur.com/Iz7uIcC.png
     
  5. jimbo8 one note for the database. You don't need the blokk column, as that is stored using the x y and z of the location as well, which is faster

    For the checking you want to do this:

    Code:java
    1.  
    2. String name = player.getName();
    3. int x = ...
    4. int y = ...
    5. int z = ...
    6. ResultSet rs = plugin.sql.sqlQuery("SELECT * FROM blockplace WHERE brukernavn = 'name' AND x = "+x+" AND y = "+y+" AND z = "+z);
    7. if(rs.hasNext){
    8. //the player placed a block at that location.
    9. }
    10. /syntax]
    11. But taking into account that a block can be broken and placed by multiple people and you only want the latest person to be able to break the block you can try this query: "SELECT brukernavn FROM blockplace WHERE x = "+x+" AND y = "+y+" AND z = "+z+" ORDER BY id DESC" and then use the following code to check if the player that is trying to break the block is in fact the owner
    12.  
    13. [syntax=java]ResultSet rs = plugin.sql.sqlQuery("SELECT brukernavn FROM blockplace WHERE x = "+x+" AND y = "+y+" AND z = "+z+" ORDER BY id DESC LIMIT 1");
    14. while(rs.hasNext()){
    15. String owner = rs.getString(1);
    16. if(owner.equals(player.getName()){
    17. //he is the lastes placer
    18. }
    19. else{
    20. //he is not
    21. }
    22. }
    23. [/syntax]
     
  6. Offline

    jimbo8

    Thanks, this works! :)

    Just one more thing, do you know how i could add a date?

    Let's say I'm checking a grief in one of my cities, and is using my clock to see who broke the blocks, but i also want to see the time it happened. How would i do that?

    Sgt_Tailor
     
  7. jimbo8 add a timestamp column to the table, but instead of sorting by id you can then sort by time :)
     
  8. Offline

    jimbo8

    Sgt_Tailor

    I will see what i can do, i guess the SQL docs says something about it :)
     
  9. Code:
    "CREATE TABLE blockplace(id INT AUTO_INCREMENT PRIMARY, brukernavn VARCHAR(16) NOT NULL, x INT NOT NULL, y INT NOT NULL, z INT NOT NULL, verden VARCHAR NOT NULL, time TIMESTAMP)"
    you can use that query to create the table. I wasn't sure what blokk is for (I guess the id of the block), but you can add that if you need it :)
     
  10. Offline

    jimbo8

    Sgt_Tailor

    Okay, so i figured out that SQLite got locked every time i did something and i had to close the connection every time i did something with the connection, if i forget to clsoe the connection, the database locks :s

    So i tried using MySQL instead and got this error;

    Code:
    [15:12:31 WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You
    have an error in your SQL syntax; check the manual that corresponds to your MySQ
    L server version for the right syntax to use near ' brukernavn VARCHAR(16) NOT N
    ULL, x INT NOT NULL, y INT NOT NULL, z INT NOT NULL' at line 1
    This is the line(s);

    Code:
    sql.standardQuery("CREATE TABLE blockbreak(ID INT AUTO_INCREMENT PRIMARY, brukernavn VARCHAR(16) NOT NULL, x INT NOT NULL, y INT NOT NULL, z INT NOT NULL, verden VARCHAR NOT NULL, tid TIMESTAMP);");
    
    Code:
    sql.standardQuery("CREATE TABLE blockplace(ID INT AUTO_INCREMENT PRIMARY, brukernavn VARCHAR(16) NOT NULL, x INT NOT NULL, y INT NOT NULL, z INT NOT NULL, verden VARCHAR NOT NULL, tid TIMESTAMP);");
    
    Btw, i managed to add a timestamp, it works perfectly fine :)
     
  11. jimbo8 I will get on my main pc to run the query, it is most likely a stupid mistake. Let me get a coffee to wake me up a bit :p
     
    jimbo8 likes this.
  12. Offline

    jimbo8

  13. jimbo8 I'm at my pc. Starting up my server to do some queries ;)
     
    jimbo8 likes this.
  14. Offline

    jimbo8

    Sgt_Tailor

    Tell me when you figured out something :)
     
  15. jimbo8 This works:
    Code:
    CREATE TABLE IF NOT EXISTS blockplace(
     ID INT AUTO_INCREMENT PRIMARY KEY,
    brukernavn VARCHAR(16) NOT NULL,
    x INT NOT NULL,
    y INT NOT NULL,
    z INT NOT NULL,
    verden VARCHAR(30) NOT NULL,
    tid TIMESTAMP)
    
    the world name can not be bigger than 30 characters, feel free to change that
     
  16. Offline

    jimbo8

    Sgt_Tailor

    Thanks, it works now :)

    Only problem is that i got this error when i use my clock to check the block protection, and i don't really understand what it means :p

    Code:
    [16:20:11 WARN]: java.sql.SQLException: Before start of result set
    [16:20:11 WARN]:        at com.mysql.jdbc.SQLError.createSQLException(SQLError.j
    ava:1073)
    [16:20:11 WARN]:        at com.mysql.jdbc.SQLError.createSQLException(SQLError.j
    ava:987)
    [16:20:11 WARN]:        at com.mysql.jdbc.SQLError.createSQLException(SQLError.j
    ava:982)
    [16:20:11 WARN]:        at com.mysql.jdbc.SQLError.createSQLException(SQLError.j
    ava:927)
    [16:20:11 WARN]:        at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImp
    l.java:841)
    [16:20:11 WARN]:        at com.mysql.jdbc.ResultSetImpl.getStringInternal(Result
    SetImpl.java:5656)
    [16:20:11 WARN]:        at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.
    java:5576)
    [16:20:11 WARN]:        at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.
    java:5616)
    [16:20:11 WARN]:        at me.Thomas.MySQL.BlockLog.SjekkBlokkLogg.sjekkLogg(Sje
    kkBlokkLogg.java:58)
    [16:20:11 WARN]:        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native M
    ethod)
    [16:20:11 WARN]:        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown S
    ource)
    [16:20:11 WARN]:        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unkno
    wn Source)
    [16:20:11 WARN]:        at java.lang.reflect.Method.invoke(Unknown Source)
    [16:20:11 WARN]:        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(Jav
    aPluginLoader.java:425)
    [16:20:11 WARN]:        at org.bukkit.plugin.RegisteredListener.callEvent(Regist
    eredListener.java:62)
    [16:20:11 WARN]:        at org.bukkit.plugin.TimedRegisteredListener.callEvent(T
    imedRegisteredListener.java:30)
    [16:20:11 WARN]:        at org.bukkit.plugin.SimplePluginManager.fireEvent(Simpl
    ePluginManager.java:482)
    [16:20:11 WARN]:        at org.bukkit.plugin.SimplePluginManager.callEvent(Simpl
    ePluginManager.java:467)
    [16:20:11 WARN]:        at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactor
    y.callPlayerInteractEvent(CraftEventFactory.java:208)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.PlayerInteractManager.di
    g(PlayerInteractManager.java:103)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.PlayerConnection.a(Playe
    rConnection.java:536)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.PacketPlayInBlockDig.a(S
    ourceFile:53)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.PacketPlayInBlockDig.han
    dle(SourceFile:8)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.NetworkManager.a(Network
    Manager.java:147)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.ServerConnection.c(Sourc
    eFile:134)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.MinecraftServer.u(Minecr
    aftServer.java:657)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.DedicatedServer.u(Dedica
    tedServer.java:273)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.MinecraftServer.t(Minecr
    aftServer.java:540)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.MinecraftServer.run(Mine
    craftServer.java:446)
    [16:20:11 WARN]:        at net.minecraft.server.v1_7_R1.ThreadServerApplication.
    run(SourceFile:617)
    "Before start of resultset"

    What? I don't really understand :p

    Here is the code it is pointing to;

    Code:java
    1. package me.Thomas.MySQL.BlockLog;
    2.  
    3. import java.sql.ResultSet;
    4. import java.sql.SQLException;
    5.  
    6. import me.Thomas.mindwork.Mindwork;
    7.  
    8. import org.bukkit.ChatColor;
    9. import org.bukkit.Material;
    10. import org.bukkit.World;
    11. import org.bukkit.entity.Player;
    12. import org.bukkit.event.EventHandler;
    13. import org.bukkit.event.Listener;
    14. import org.bukkit.event.block.Action;
    15. import org.bukkit.event.player.PlayerInteractEvent;
    16.  
    17. public class SjekkBlokkLogg implements Listener{
    18. Mindwork plugin;
    19.  
    20. public SjekkBlokkLogg(Mindwork instance){
    21. plugin = instance;
    22. }
    23.  
    24. @EventHandler
    25. public void sjekkLogg(PlayerInteractEvent event){
    26. Player player = event.getPlayer();
    27. if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
    28. if (player.getItemInHand().getType() == Material.WATCH) {
    29. int x = event.getClickedBlock().getLocation().getBlockX();
    30. int y = event.getClickedBlock().getLocation().getBlockY();
    31. int z = event.getClickedBlock().getLocation().getBlockZ();
    32. World world = player.getWorld();
    33. plugin.sql.initialise();
    34. try {
    35. ResultSet coordset = plugin.sql.sqlQuery("SELECT * FROM blockbreak WHERE verden='" + world.getName() + "' AND x=" + x + " AND y=" + y + " AND z=" + z + ";");
    36. ResultSet playerset = plugin.sql.sqlQuery("SELECT brukernavn FROM blockbreak;");
    37. while(coordset.next()){
    38. player.sendMessage(ChatColor.GRAY + "Denne blokken ble fjernet av " + playerset.getString("brukernavn") + ". Koordinater: " + ChatColor.GREEN + "\nX: " + coordset.getString("x") + ChatColor.DARK_GRAY + "," + ChatColor.RED + " Y: " + coordset.getString("y") + ChatColor.DARK_GRAY +"," + ChatColor.BLUE + " Z: " + coordset.getString("z") + ChatColor.GRAY + "\nVerden: " + ChatColor.AQUA + coordset.getString("verden") + ChatColor.GRAY + "\nTid: " + ChatColor.GOLD + coordset.getString("tid"));
    39.  
    40. }
    41. }
    42. catch (SQLException e) {
    43. e.printStackTrace();
    44. }
    45. }
    46. }
    47. if(event.getAction() == Action.LEFT_CLICK_BLOCK){
    48. if (player.getItemInHand().getType() == Material.WATCH) {
    49. event.setCancelled(true);
    50. int x = event.getClickedBlock().getLocation().getBlockX();
    51. int y = event.getClickedBlock().getLocation().getBlockY();
    52. int z = event.getClickedBlock().getLocation().getBlockZ();
    53. World world = player.getWorld();
    54. try {
    55. ResultSet coordset2 = plugin.sql.sqlQuery("SELECT * FROM blockplace WHERE verden='" + world.getName() + "' AND x=" + x + " AND y=" + y + " AND z=" + z + ";");
    56. ResultSet playerset2 = plugin.sql.sqlQuery("SELECT brukernavn FROM blockplace;");
    57. while(coordset2.next()){
    58. player.sendMessage(ChatColor.GRAY + "Denne blokken ble plassert av " + ChatColor.WHITE + playerset2.getString("brukernavn") + ChatColor.GRAY + ". Koordinater: " + ChatColor.GREEN + "\nX: " + coordset2.getString("x") + ChatColor.DARK_GRAY + "," + ChatColor.RED + " Y: " + coordset2.getString("y") + ChatColor.DARK_GRAY +"," + ChatColor.BLUE + " Z: " + coordset2.getString("z") + ChatColor.GRAY + "\nVerden: " + ChatColor.AQUA + coordset2.getString("verden") + ChatColor.GRAY + "\nTid: " + ChatColor.GOLD + coordset2.getString("tid"));
    59. }
    60. }
    61. catch (SQLException e) {
    62. e.printStackTrace();
    63.  
    64. }
    65.  
    66. }
    67.  
    68. }
    69. }
    70. }
    71.  


    where line 58 is here:

    Code:java
    1. player.sendMessage(ChatColor.GRAY + "Denne blokken ble plassert av " + ChatColor.WHITE + playerset2.getString("brukernavn") + ChatColor.GRAY + ". Koordinater: " + ChatColor.GREEN + "\nX: " + coordset2.getString("x") + ChatColor.DARK_GRAY + "," + ChatColor.RED + " Y: " + coordset2.getString("y") + ChatColor.DARK_GRAY +"," + ChatColor.BLUE + " Z: " + coordset2.getString("z") + ChatColor.GRAY + "\nVerden: " + ChatColor.AQUA + coordset2.getString("verden") + ChatColor.GRAY + "\nTid: " + ChatColor.GOLD + coordset2.getString("tid"));
    2.  
     
  17. jimbo8 try playerset2.getString(1), as column count is used, not the names :)
     
  18. Offline

    jimbo8

    Sgt_Tailor

    Hmm, does still not work.

    Exactly the same error.
     
  19. jimbo8 you need to make a new while loop: while(playerset2.next())
     
  20. Offline

    jimbo8

    Ah, of course. Thanks.

    Do you know how i can get the last placer of the block?

    As i have removed the block a lot of times, it spams me with every playername that broke the block at that location.

    [EDIT]

    Actually, it gets every single block broken/placed on the whole server.

    Nevermind, forgot to sort by ID.
     
  21. jimbo8 If this solved the issue then you can mark this as solved. If I helped you could leave me a like ;)
     
  22. Offline

    jimbo8

    Sgt_Tailor

    Hi :)

    I think this will be the last question, but do you know what i should do if i want to change the block protection to another person? I know i can get the target block, get the name of the owner of the targeted block and then change the owner name, but what if i want to change regions?

    Like, let's say i mark a 10x10 area with a wooden axe, how could i then change every block within that radius to a chosen player?

    Like this:

    /blockprotection <playername>

    ..Will change every protected block to the chosen user.

    Also, how could i protect a marked area? I've built my spawn a few weeks ago, so it does not contain the block protection, how would i save every block? Kinda the same way as changing block protection?

    [EDIT]

    Also.. I need to remove the person from that ID after the block has been broken by the same person, because if i place a block, and then you place one on the same coordinates, it will be locked on me

    Nevermind. But i got a lot of bugs, though.

    I'm using a clock to check who placed the block, but it only tells the last person who placed a block on the whole server, not on those coordinates. I don't see what's wrong:

    Code:java
    1. try {
    2. ResultSet coordset2 = plugin.sql.sqlQuery("SELECT * FROM blockplace WHERE verden='" + world.getName() + "' AND x=" + x + " AND y=" + y + " AND z=" + z + " ORDER BY id DESC LIMIT 1;");
    3. ResultSet playerset2 = plugin.sql.sqlQuery("SELECT brukernavn FROM blockplace ORDER BY id DESC LIMIT 1;");
    4. while(coordset2.next()){
    5. while(playerset2.next()){
    6. player.sendMessage(ChatColor.GRAY + "This block was placed by " + ChatColor.WHITE + playerset2.getString(1) + ChatColor.GRAY + ". Koordinater: " + ChatColor.GREEN + "\nX: " + coordset2.getString("x") + ChatColor.DARK_GRAY + "," + ChatColor.RED + " Y: " + coordset2.getString("y") + ChatColor.DARK_GRAY +"," + ChatColor.BLUE + " Z: " + coordset2.getString("z") + ChatColor.GRAY + "\World: " + ChatColor.AQUA + coordset2.getString("verden") + ChatColor.GRAY + "\nTime: " + ChatColor.GOLD + coordset2.getString("tid"));
    7. }
    8. }
    9. }catch (SQLException e) {
    10. e.printStackTrace();
    11.  
    12. }
     
  23. jimbo8 why do you need playerset2? you can just do coordset.getString(1)
     
  24. Offline

    jimbo8

    I tried to remove it, but then i just get this "end of resultset" error.

    Nevermind, fixed it.

    Still trying to find out how i can change protection in areas :p
    Sgt_Tailor
     
  25. jimbo8 how would you define an area?
     
  26. Offline

    jimbo8

    Sgt_Tailor

    Let's say i have a wooden axe.

    I mark two areas, mark one and two is 30 blocks away from eachother. Now, if i type /changebp sgt_tailor(or something like that), every single block in the marked area will be protected for you, only you can break it now.
     
  27. you can have two options, hava a table with areas (id, blockpos1, blockpos2) and when someone breaks a block iterate though all the areas and check if the block is inside it. Or for every block in the area, set that the latest placer is playerA. You could alternatively use blockMetaData to store this as well and only change that on block break and place. That would prevent you from connection to the database every time someone breaks a block.
     
Thread Status:
Not open for further replies.

Share This Page