mirror of
https://e.coding.net/circlecloud/CityBuild.git
synced 2024-11-21 10:48:49 +00:00
change list to type add jiaohu jiance...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
fd5bab9e5b
commit
f89d2d4f43
@ -15,7 +15,7 @@ public class CityBuild extends JavaPlugin implements CommandExecutor {
|
||||
public boolean tipplayer;
|
||||
|
||||
public void onLoad() {
|
||||
Config.load(this, "1.0");
|
||||
Config.load(this, "1.1");
|
||||
servername = getmessage("servername");
|
||||
pluginname = getmessage("pluginname");
|
||||
tipplayer = Config.getInstance().getBoolean("tipplayer");
|
||||
|
@ -8,6 +8,7 @@ import com.bekvon.bukkit.residence.protection.ClaimedResidence;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,6 +16,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class Build implements Listener {
|
||||
|
||||
@ -24,18 +26,46 @@ public class Build implements Listener {
|
||||
plugin = main;
|
||||
}
|
||||
|
||||
// PlayerInteractEvent.class
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void playerInteract(PlayerInteractEvent event) {
|
||||
event.setCancelled(CancelEvent(event.getPlayer(), event.getMaterial()));
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void blockBreak(BlockBreakEvent event) {
|
||||
if (CancelEvent(event.getPlayer(), event.getBlock(), false)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
event.setCancelled(CancelEvent(event.getPlayer(), event.getBlock(),
|
||||
false));
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void blockplace(BlockPlaceEvent event) {
|
||||
if (CancelEvent(event.getPlayer(), event.getBlock(), true)) {
|
||||
event.setCancelled(true);
|
||||
event.setCancelled(CancelEvent(event.getPlayer(), event.getBlock(),
|
||||
true));
|
||||
}
|
||||
|
||||
public boolean CancelEvent(Player p, Material m) {
|
||||
ClaimedResidence res = Residence.getResidenceManager().getByLoc(
|
||||
p.getLocation());
|
||||
if (res == null && !p.hasPermission("cb.build")) {
|
||||
String blockname = m.name();
|
||||
for (String protectworld : Config.getInstance().getStringList(
|
||||
"ProtectWorld")) {
|
||||
if (protectworld.equalsIgnoreCase(p.getWorld().getName())) {
|
||||
for (String notallowblock : Config.getInstance()
|
||||
.getStringList("NotAllowList")) {
|
||||
if (blockname.equalsIgnoreCase(notallowblock)) {
|
||||
if (plugin.tipplayer)
|
||||
p.getPlayer().sendMessage(
|
||||
plugin.getfullmsg("Message.NotAllow"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean CancelEvent(Player p, Block b, boolean place) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#本文件为保护插件的主配置文件
|
||||
version: '1.0'
|
||||
version: '1.1'
|
||||
#服务器名称
|
||||
servername: ''
|
||||
#插件名称
|
||||
@ -27,6 +27,8 @@ Message:
|
||||
#解除限制说明
|
||||
Relieve: '&c如需解除限制请圈地,&6工具:木锄&c,&b价格:0.3元/方块&c!'
|
||||
|
||||
#不允许交互的提示
|
||||
NotAllow: '&c当前物品不允许在领地外使用!'
|
||||
|
||||
#城市保护配置
|
||||
#未圈地最大高度
|
||||
@ -57,3 +59,9 @@ AllowList:
|
||||
- RED_ROSE
|
||||
- LOG_2
|
||||
- LOG
|
||||
- YELLOW_FLOWER
|
||||
|
||||
#领地外阻止交互的物品
|
||||
NotAllowList:
|
||||
- WATER_BUCKET
|
||||
- LAVA_BUCKET
|
Loading…
Reference in New Issue
Block a user