2011-09-01 18:59:15 +02:00
|
|
|
package com.Acrobot.ChestShop.Protection.Plugins;
|
2011-05-15 18:16:25 +02:00
|
|
|
|
2011-09-01 18:59:15 +02:00
|
|
|
import com.Acrobot.ChestShop.Protection.Protection;
|
2011-05-15 18:16:25 +02:00
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.entity.Player;
|
2011-09-06 19:01:57 +02:00
|
|
|
import org.yi.acru.bukkit.Lockette.Lockette;
|
2011-05-15 18:16:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Acrobot
|
|
|
|
*/
|
2011-05-29 13:25:25 +02:00
|
|
|
public class LockettePlugin implements Protection {
|
2011-05-15 18:16:25 +02:00
|
|
|
public static Lockette lockette;
|
|
|
|
|
|
|
|
public boolean isProtected(Block block) {
|
|
|
|
return Lockette.isProtected(block);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean canAccess(Player player, Block block) {
|
2012-01-09 22:39:38 +01:00
|
|
|
String pName = player.getName();
|
|
|
|
int length = (pName.length() > 15 ? 15 : pName.length());
|
|
|
|
String owner = Lockette.getProtectedOwner(block);
|
|
|
|
return owner == null || pName.substring(0, length).equals(owner);
|
2011-05-15 18:16:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean protect(String name, Block block) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|