BlockProtection Reloaded
BlockProtection
This is a continuation of the BlockProtection plugin by Kanlaki101. A block protection plugin based off of OwnBlocks by cvenomz. BlockProtection will save any block you place down, to prevent other players from breaking it. Only the player who placed the block, anyone on his friends list, or an admin can break the block.
Developers, have suggestions, or would like to help? I welcome any and all help. Join me in IRC, or PM me!
Dependencies
Vault: Vault is required for BlockProtection to work on your server. Vault is used as an API so that BlockProtection can hook into almost every permissions system.
You can get Vault Link.
WorldEdit is Soft Dependencie. Needed for selected region block protection transfer.
You can get WorldEdit Link.
Features:
Block Protection
Every block your players place will be protected in the database.
Block Exclude List
Prevent certain blocks from being protected.
Admin Bypass
Your admins can bypass BlockProtection and break any player's blocks.
Friends System
Allow your players to build with friends! They can add/remove them as needed.
Where do I begin?
Installation:
- Make sure you have Vault installed.
- Drop BlockProtection.jar into your /plugins folder.
- On first load, config.yml, friendslist.yml, and the Database.db will be created.
- Open config.yml and edit it to your liking, then use the /bpreload command.
Permissions:
- bp.admin (Defaults to op) Allows players bypass BlockProtection, add blocks manually, and get the utility tool
- bp.friend (Defaults to true) Allows access to all of the Friends List features
- bp.reload (Defaults to op) Allows admins to reload all settings from the configuration file
- bp.user (Defaults to true) Allow players to use BlockProtection, and view the owner of blocks
- bp.giveblock (Defaults to op) Allows to give block (by Tool (stick by default))
- bp.transfer (Defaults to op) Allows to transfer blocks from WorldEdit selected region
Commands
- /bp [on/off] Toggle BlockProtection on/off, adding on/off is optional.
- /bpadd [playername] Add a player to your friends list
- /bpadmin Toggle BlockProtection bypass on/off
- /bpclear Clears your entire friends list
- /bplist List all players from your friends list
- /bpreload (Will not reload changes to "save-interval". Restart required!) Reloads settings from config.yml
- /bpremove [playername] Remove a player from friends list
- /bptool Gives the player 1 of the "utility tool"
- /bpgive [playername] All blocks will be given to Name player, by using Tool. To disable write /bpgive.
- /bptransfer [playername] After region selected by World edit. This command will transfer protection of selected blocks to [playername]. When no arguments are given the protection of the selected blocks will be removed. You need bp.transfer or bp.admin to do this.
- /bpimport [world] Import's blocks from WatchBlock MySQL. Check config for MySQL connection settings. If there are many blocks in the database please wait.
Suggestions/Help:
Very important: If you want something added or fixed, reply to questions I will ask!
To submit a ticket for help or a suggestion, click the ticket tab on the top of the page. Create a new ticket, and add the appropriate label.
@HollandCraft
Depend of how big is your server , how much is protected blocks. Its can't be 1mb if you have 1bilion cubes. It's hold all DB in memory - so it's faster than MySQL. But use some RAM. (i don't think 100mb is SOOO MACH)
@ScrimCraft
Not yet.
@HollandCraft
It should work fine, MySQL will not be added.
Does this protect entities like frames?
This crashed my server and will not work. I did import it and it seems successful but when I start up my server and when it gets to BlockProtection is just freezes at [BlockProtection] using existing database file... I guess it's done. I'll make a new map for my server... Thank anyways guys :(
16:22:11 [INFO] Larry issued server command: /bpimport
16:22:11 [SEVERE] null
org.bukkit.command.CommandException Unhandled exception executing command 'bpim
port' in plugin BlockProtection v3.0.5
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
6)
at org.bukkit.craftbukkit.v1_4_R1.CraftServer.dispatchCommand(CraftServe
r.java:514)
at net.minecraft.server.v1_4_R1.PlayerConnection.handleCommand(PlayerCon
nection.java:980
at net.minecraft.server.v1_4_R1.PlayerConnection.chat(PlayerConnection.j
ava:898)
at net.minecraft.server.v1_4_R1.PlayerConnection.a(PlayerConnection.java
:853)
at net.minecraft.server.v1_4_R1.Packet3Chat.handle(Packet3Chat.java:44)
at net.minecraft.server.v1_4_R1.NetworkManager.b(NetworkManager.java:290
)
at net.minecraft.server.v1_4_R1.PlayerConnection.d(PlayerConnection.java
:113)
at net.minecraft.server.v1_4_R1.ServerConnection.b(SourceFile:39)
at net.minecraft.server.v1_4_R1.DedicatedServerConnection.b(SourceFile:3
0)
at net.minecraft.server.v1_4_R1.MinecraftServer.r(MinecraftServer.java:5
98)
at net.minecraft.server.v1_4_R1.DedicatedServer.r(DedicatedServer.java:2
24)
at net.minecraft.server.v1_4_R1.MinecraftServer.q(MinecraftServer.java:4
94)
at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java
:427)
at net.minecraft.server.v1_4_R1.ThreadServerApplication.run(SourceFile:8
49)
Caused by: java.lang.ArrayIndexOutOfBoundsException 0
at info.kanlaki101.blockprotection.commands.BPImport.onCommand(BPImport.
java:44)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
... 15 more
16:22:14 [INFO] Larry issued server command: /bpimport ScrimCraft
16:22:24 [WARNING] [Server] The main thread failed to respond after 10 seconds
16:22:24 [WARNING] [Server] Probable Plugin cause: 'BlockProtection'
16:22:24 [WARNING] [Server] What follows is the stack trace of the main thread
16:22:24 [WARNING] [Server] at java.net.SocketInputStream.socketRead0(Native
Method)
16:22:24 [WARNING] [Server] at java.net.SocketInputStream.read(Unknown Source
)
16:22:24 [WARNING] [Server] at java.net.SocketInputStream.read(Unknown Source
)
16:22:24 [WARNING] [Server] at com.mysql.jdbc.util.ReadAheadInputStream.fill(
ReadAheadInputStream.java:114
16:22:24 [WARNING] [Server] at com.mysql.jdbc.util.ReadAheadInputStream.read(
ReadAheadInputStream.java:221
16:22:24 [WARNING] [Server] at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.jav
a:1548)
16:22:24 [WARNING] [Server] at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:14
22)
16:22:24 [WARNING] [Server] at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlI
O.java:2913)
16:22:24 [WARNING] [Server] at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.ja
va:476)
16:22:24 [WARNING] [Server] at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUp
date(MysqlIO.java:2608
16:22:24 [WARNING] [Server] at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.
java:1784)
16:22:24 [WARNING] [Server] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.
java:2198)
16:22:24 [WARNING] [Server] at com.mysql.jdbc.ConnectionImpl.execSQL(Connecti
onImpl.java:2620
16:22:24 [WARNING] [Server] at com.mysql.jdbc.ConnectionImpl.execSQL(Connecti
onImpl.java:2570
16:22:24 [WARNING] [Server] at com.mysql.jdbc.StatementImpl.executeQuery(Stat
ementImpl.java:1474
16:22:24 [WARNING] [Server] at info.kanlaki101.blockprotection.commands.BPImp
ort.newReceiveEntries(BPImport.java:84)
16:22:24 [WARNING] [Server] at info.kanlaki101.blockprotection.commands.BPImp
ort.onCommand(BPImport.java:47)
16:22:24 [WARNING] [Server] at org.bukkit.command.PluginCommand.execute(Plugi
nCommand.java:44
16:22:24 [WARNING] [Server] at org.bukkit.command.SimpleCommandMap.dispatch(S
impleCommandMap.java:186
16:22:24 [WARNING] [Server] at org.bukkit.craftbukkit.v1_4_R1.CraftServer.dis
patchCommand(CraftServer.java:514
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.PlayerConnection
handleCommand(PlayerConnection.java:980
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.PlayerConnection
chat(PlayerConnection.java:898
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.PlayerConnection
a(PlayerConnection.java:853
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.Packet3Chat.handl
e(Packet3Chat.java:44
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.NetworkManager.b(
NetworkManager.java:290
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.PlayerConnection
d(PlayerConnection.java:113
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.ServerConnection
b(SourceFile:39)
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.DedicatedServerCo
nnection.b(SourceFile:30)
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.MinecraftServer.r
(MinecraftServer.java:598
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.DedicatedServer.r
(DedicatedServer.java:224
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.MinecraftServer.q
(MinecraftServer.java:494
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.MinecraftServer.r
un(MinecraftServer.java:427
16:22:24 [WARNING] [Server] at net.minecraft.server.v1_4_R1.ThreadServerAppli
cation.run(SourceFile:849)
16:22:36 [WARNING] [Server] The main thread is still stuck, current loop line is
:
16:22:36 [WARNING] [Server] at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:14
22)
16:22:36 [WARNING] [Server] This appears to be plugin 'BlockProtection'!
16:22:52 [INFO] Importing World: ScrimCraft ! This may take a while!
16:22:54 [WARNING] [Server] The main thread is still stuck, current loop line is
:
16:22:54 [WARNING] [Server] at org.bukkit.command.PluginCommand.execute(Plugi
nCommand.java:44
16:22:54 [WARNING] [Server] This appears to be plugin 'BlockProtection'!
16:22:54 [INFO] Imported
Are you planning to add Mysql?
Or how will this plugin work on a server with 150 players online?
Is it leightweight?
@blackwolf12333
Holy crap! It worked! THANK YOU!!! :D
@ScrimCraft
You have to add the worldname of the world you want to import, if you just use the default world your command would look like this: /bpimport world
Are you fixing this problem or have you given up hope for me?
Just promise me you'll keep this updated so I don't have to deal with this kind of problem again!
I guess I'll make a new map :( ...
This is EXACTLY what it says for /wb-import flat-to-sql as well
17:11:26 [INFO] Larry issued server command: /bpimport
17:11:26 [SEVERE] null
org.bukkit.command.CommandException Unhandled exception executing command 'bpim
port' in plugin BlockProtection v3.0.5
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:18
6)
at org.bukkit.craftbukkit.v1_4_R1.CraftServer.dispatchCommand(CraftServe
r.java:514)
at net.minecraft.server.v1_4_R1.PlayerConnection.handleCommand(PlayerCon
nection.java:980
at net.minecraft.server.v1_4_R1.PlayerConnection.chat(PlayerConnection.j
ava:898)
at net.minecraft.server.v1_4_R1.PlayerConnection.a(PlayerConnection.java
:853)
at net.minecraft.server.v1_4_R1.Packet3Chat.handle(Packet3Chat.java:44)
at net.minecraft.server.v1_4_R1.NetworkManager.b(NetworkManager.java:290
)
at net.minecraft.server.v1_4_R1.PlayerConnection.d(PlayerConnection.java
:113)
at net.minecraft.server.v1_4_R1.ServerConnection.b(SourceFile:39)
at net.minecraft.server.v1_4_R1.DedicatedServerConnection.b(SourceFile:3
0)
at net.minecraft.server.v1_4_R1.MinecraftServer.r(MinecraftServer.java:5
98)
at net.minecraft.server.v1_4_R1.DedicatedServer.r(DedicatedServer.java:2
24)
at net.minecraft.server.v1_4_R1.MinecraftServer.q(MinecraftServer.java:4
94)
at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java
:427)
at net.minecraft.server.v1_4_R1.ThreadServerApplication.run(SourceFile:8
49)
Caused by: java.lang.ArrayIndexOutOfBoundsException 0
at info.kanlaki101.blockprotection.commands.BPImport.onCommand(BPImport.
java:44)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
... 15 more
@ScrimCraft
In that case it should just work. Try again:/
It is matched!
database: "watchblock"
port: 3306
username: "root"
password: "root"
hostname: "localhost"
poolsize: 10
MySQL:
port: '3306'
username: root
poolsize: '10'
hostname: localhost
password: root
database: WatchBlock
@ScrimCraft
They are made compatible... I guess you didn't change the config of BlockProtection to match the setting for the sql server of WatchBlock. If you didn't do that you indeed can't use /bpimport...
Maybe the BlockProtection and WatchBlock are not compatible? I see that BlockProtection uses just a simple DB file while watchblock uses a whole list of regions im assuming. Or is it just the /bpreload that is broken?
Since I exported the WatchBlock.sql what do I do with it... It STILL won't let me /bpimport
The MySQL data in BlockProtection and WatchBlock are identically the same. I just can't use the command /wb-import flat-to-sql or /bpimport
Okay, this will probably the last time I'll make a post, but I successfully exported the data and stuff from MySQL and I don't know what to do with it
--
-- MySQL 5.5.24
-- Wed, 13 Feb 2013 23:22:54 +0000
--
CREATE TABLE `allowlist` (
`pid` int(11) not null,
`allowedplayers` varchar(1500),
KEY `pid` (`pid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- [Table `allowlist` is empty]
CREATE TABLE `players` (
`pid` int(11) not null auto_increment,
`playername` varchar(50),
PRIMARY KEY (`pid`),
KEY `player_idx` (`pid`,`playername`),
KEY `playername_idx` (`playername`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6;
INSERT INTO `players` (`pid`, `playername`) VALUES
('1', 'asdfman'),
('2', 'Phalanix'),
('3', 'george_egroeg'),
('4', 'Diamond_32X'),
('5', 'girlwithabow');
CREATE TABLE `scrimcraft_blocks` (
`bid` int(11) not null auto_increment,
`cid` int(11) not null,
`x` int(11) not null,
`y` int(11) not null,
`z` int(11) not null,
`player` int(11) not null,
PRIMARY KEY (`bid`),
KEY `coors_idx` (`x`,`y`,`z`),
KEY `coor_idx` (`bid`,`cid`,`x`,`y`,`z`),
KEY `blockid_idx` (`cid`,`bid`),
KEY `b_idx` (`cid`,`x`,`y`,`z`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=41;
INSERT INTO `scrimcraft_blocks` (`bid`, `cid`, `x`, `y`, `z`, `player`) VALUES
('1', '1', '-746', '55', '371', '1'),
('17', '3', '-921', '63', '-7587', '3'),
('18', '3', '-923', '63', '-7587', '3'),
('16', '3', '-921', '63', '-7588', '3'),
('14', '2', '-460', '53', '266', '2'),
('15', '2', '-460', '53', '265', '2'),
('19', '3', '-923', '63', '-7586', '3'),
('20', '3', '-923', '63', '-7588', '3'),
('21', '1', '-748', '55', '373', '1'),
('22', '1', '-747', '55', '373', '1'),
('23', '1', '-746', '55', '373', '1'),
('24', '4', '-905', '25', '-7543', '4'),
('25', '4', '-905', '26', '-7543', '4'),
('28', '4', '-911', '13', '-7541', '4'),
('27', '4', '-905', '24', '-7541', '4'),
('29', '4', '-910', '13', '-7541', '4'),
('30', '4', '-911', '13', '-7540', '4'),
('31', '4', '-911', '13', '-7539', '4'),
('32', '5', '-895', '17', '-7545', '4'),
('33', '6', '-296', '64', '-775', '5'),
('34', '6', '-296', '65', '-776', '5'),
('35', '5', '-883', '19', '-7547', '3'),
('36', '7', '-877', '22', '-7543', '3'),
('37', '4', '-908', '15', '-7544', '3'),
('38', '8', '-913', '14', '-7538', '3'),
('39', '9', '-914', '15', '-7528', '3'),
('40', '4', '-898', '18', '-7546', '3');
CREATE TABLE `scrimcraft_chunks` (
`cid` int(11) not null auto_increment,
`mainid` int(11) not null,
`cx` int(11) not null,
`cz` int(11) not null,
PRIMARY KEY (`cid`),
KEY `cid_idx` (`cid`,`cx`,`cz`),
KEY `chunk_idx` (`cx`,`cz`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=10;
INSERT INTO `scrimcraft_chunks` (`cid`, `mainid`, `cx`, `cz`) VALUES
('1', '1', '-47', '23'),
('2', '1', '-29', '16'),
('3', '1', '-58', '-475'),
('4', '1', '-57', '-472'),
('5', '1', '-56', '-472'),
('6', '1', '-19', '-49'),
('7', '1', '-55', '-472'),
('8', '1', '-58', '-472'),
('9', '1', '-58', '-471');
CREATE TABLE `scrimcraft_nether_blocks` (
`bid` int(11) not null auto_increment,
`cid` int(11) not null,
`x` int(11) not null,
`y` int(11) not null,
`z` int(11) not null,
`player` int(11) not null,
PRIMARY KEY (`bid`),
KEY `coors_idx` (`x`,`y`,`z`),
KEY `coor_idx` (`bid`,`cid`,`x`,`y`,`z`),
KEY `blockid_idx` (`cid`,`bid`),
KEY `b_idx` (`cid`,`x`,`y`,`z`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-- [Table `scrimcraft_nether_blocks` is empty]
CREATE TABLE `scrimcraft_nether_chunks` (
`cid` int(11) not null auto_increment,
`mainid` int(11) not null,
`cx` int(11) not null,
`cz` int(11) not null,
PRIMARY KEY (`cid`),
KEY `cid_idx` (`cid`,`cx`,`cz`),
KEY `chunk_idx` (`cx`,`cz`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-- [Table `scrimcraft_nether_chunks` is empty]
CREATE TABLE `scrimcraft_the_end_blocks` (
`bid` int(11) not null auto_increment,
`cid` int(11) not null,
`x` int(11) not null,
`y` int(11) not null,
`z` int(11) not null,
`player` int(11) not null,
PRIMARY KEY (`bid`),
KEY `coors_idx` (`x`,`y`,`z`),
KEY `coor_idx` (`bid`,`cid`,`x`,`y`,`z`),
KEY `blockid_idx` (`cid`,`bid`),
KEY `b_idx` (`cid`,`x`,`y`,`z`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-- [Table `scrimcraft_the_end_blocks` is empty]
CREATE TABLE `scrimcraft_the_end_chunks` (
`cid` int(11) not null auto_increment,
`mainid` int(11) not null,
`cx` int(11) not null,
`cz` int(11) not null,
PRIMARY KEY (`cid`),
KEY `cid_idx` (`cid`,`cx`,`cz`),
KEY `chunk_idx` (`cx`,`cz`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-- [Table `scrimcraft_the_end_chunks` is empty]
CREATE TABLE `worlds` (
`id` int(11) not null auto_increment,
`worldname` varchar(50) not null,
PRIMARY KEY (`id`),
KEY `worldname_idx` (`worldname`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2;
INSERT INTO `worlds` (`id`, `worldname`) VALUES
('1', 'ScrimCraft');
@ScrimCraft
Please read tutorial at WatchBlock. Please..