mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
8
pom.xml
8
pom.xml
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>pw.yumc</groupId>
|
<groupId>pw.yumc</groupId>
|
||||||
<artifactId>Residence</artifactId>
|
<artifactId>Residence</artifactId>
|
||||||
<version>2.8.3.2</version>
|
<version>2.8.3.3</version>
|
||||||
<name>Residence</name>
|
<name>Residence</name>
|
||||||
<description>重制版本的领地插件 - 喵♂呜</description>
|
<description>重制版本的领地插件 - 喵♂呜</description>
|
||||||
<build>
|
<build>
|
||||||
@@ -58,15 +58,15 @@
|
|||||||
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
|
<url>http://ci.yumc.pw/job/${project.artifactId}/</url>
|
||||||
</ciManagement>
|
</ciManagement>
|
||||||
<properties>
|
<properties>
|
||||||
<update.description>&6GUI菜单上线(&c测试版本 可能存在BUG&6)...</update.description>
|
<update.description>&6GUI菜单上线(&c测试版本&6)...</update.description>
|
||||||
<update.changes>
|
<update.changes>
|
||||||
|
&b2.8.3.3 - &c添加圈地世界限制(详见dany.yml)...;
|
||||||
&b2.8.3.2 - &c去除铁轨修复补丁(1.8开始无需修复)...;
|
&b2.8.3.2 - &c去除铁轨修复补丁(1.8开始无需修复)...;
|
||||||
&b2.8.3.1 - &4修复菜单监听未启用的问题(请删除一次gui.yml)...;
|
&b2.8.3.1 - &4修复菜单监听未启用的问题(请删除一次gui.yml)...;
|
||||||
&b2.8.3.0 - &cGUI菜单测试版上线...;
|
|
||||||
</update.changes>
|
</update.changes>
|
||||||
<env.GIT_COMMIT>Debug</env.GIT_COMMIT>
|
<env.GIT_COMMIT>Debug</env.GIT_COMMIT>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigot-repo</id>
|
<id>spigot-repo</id>
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public class ResidenceMain extends JavaPlugin {
|
|||||||
protected DataBackup backup;
|
protected DataBackup backup;
|
||||||
protected ChatManager chatmanager;
|
protected ChatManager chatmanager;
|
||||||
protected FileConfig config;
|
protected FileConfig config;
|
||||||
|
protected FileConfig deny;
|
||||||
protected File dataFolder;
|
protected File dataFolder;
|
||||||
protected Map<String, String> deleteConfirm;
|
protected Map<String, String> deleteConfirm;
|
||||||
protected EconomyInterface economy;
|
protected EconomyInterface economy;
|
||||||
@@ -165,6 +166,13 @@ public class ResidenceMain extends JavaPlugin {
|
|||||||
return deleteConfirm;
|
return deleteConfirm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the deny
|
||||||
|
*/
|
||||||
|
public FileConfig getDeny() {
|
||||||
|
return deny;
|
||||||
|
}
|
||||||
|
|
||||||
public EconomyInterface getEconomyManager() {
|
public EconomyInterface getEconomyManager() {
|
||||||
return economy;
|
return economy;
|
||||||
}
|
}
|
||||||
@@ -301,7 +309,7 @@ public class ResidenceMain extends JavaPlugin {
|
|||||||
YMLSaveHelper yml;
|
YMLSaveHelper yml;
|
||||||
File loadFile;
|
File loadFile;
|
||||||
final long time = System.currentTimeMillis();
|
final long time = System.currentTimeMillis();
|
||||||
final HashMap<String, Object> worlds = new HashMap<String, Object>();
|
final HashMap<String, Object> worlds = new HashMap<>();
|
||||||
for (final World world : this.getServer().getWorlds()) {
|
for (final World world : this.getServer().getWorlds()) {
|
||||||
loadFile = new File(worldFolder, "res_" + world.getName() + ".yml");
|
loadFile = new File(worldFolder, "res_" + world.getName() + ".yml");
|
||||||
if (loadFile.isFile()) {
|
if (loadFile.isFile()) {
|
||||||
@@ -384,8 +392,8 @@ public class ResidenceMain extends JavaPlugin {
|
|||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
vergt1_8 = false;
|
vergt1_8 = false;
|
||||||
}
|
}
|
||||||
deleteConfirm = new HashMap<String, String>();
|
deleteConfirm = new HashMap<>();
|
||||||
resadminToggle = new ArrayList<String>();
|
resadminToggle = new ArrayList<>();
|
||||||
dataFolder = this.getDataFolder();
|
dataFolder = this.getDataFolder();
|
||||||
if (!dataFolder.isDirectory()) {
|
if (!dataFolder.isDirectory()) {
|
||||||
dataFolder.mkdirs();
|
dataFolder.mkdirs();
|
||||||
@@ -560,11 +568,13 @@ public class ResidenceMain extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
config = new FileConfig(this);
|
config = new FileConfig(this);
|
||||||
|
deny = new FileConfig(this, "deny.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reloadConfig() {
|
public void reloadConfig() {
|
||||||
config.reload();
|
config.reload();
|
||||||
|
deny.reload();
|
||||||
gmanager = new PermissionManager(this);
|
gmanager = new PermissionManager(this);
|
||||||
imanager = new WorldItemManager(this.getConfig());
|
imanager = new WorldItemManager(this.getConfig());
|
||||||
wmanager = new WorldFlagManager(this);
|
wmanager = new WorldFlagManager(this);
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ public class CommandCreate extends BaseCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
final Player player = (Player) sender;
|
final Player player = (Player) sender;
|
||||||
|
if (plugin.getDeny().getStringList("world").contains(player.getWorld().getName())) {
|
||||||
|
player.sendMessage("§c当前世界不允许圈地!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
final boolean resadmin = (command != null);
|
final boolean resadmin = (command != null);
|
||||||
final ResidenceManager rmanager = plugin.getResidenceManager();
|
final ResidenceManager rmanager = plugin.getResidenceManager();
|
||||||
final Language language = plugin.getLanguage();
|
final Language language = plugin.getLanguage();
|
||||||
|
|||||||
@@ -251,8 +251,7 @@ public class ResidencePlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Material mat = block.getType();
|
final Material mat = block.getType();
|
||||||
if (!((isContainer(mat, block) || isCanUseEntity_RClickOnly(mat, block)) && event.getAction() == Action.RIGHT_CLICK_BLOCK || isCanUseEntity_BothClick(mat, block)
|
if (!((isContainer(mat, block) || isCanUseEntity_RClickOnly(mat, block)) && event.getAction() == Action.RIGHT_CLICK_BLOCK || isCanUseEntity_BothClick(mat, block) || event.getAction() == Action.PHYSICAL)) {
|
||||||
|| event.getAction() == Action.PHYSICAL)) {
|
|
||||||
final int typeId = player.getItemInHand().getTypeId();
|
final int typeId = player.getItemInHand().getTypeId();
|
||||||
if (typeId != plugin.getConfigManager().getSelectionTooldID() && typeId != plugin.getConfigManager().getInfoToolID() && typeId != 351 && typeId != 416) {
|
if (typeId != plugin.getConfigManager().getSelectionTooldID() && typeId != plugin.getConfigManager().getInfoToolID() && typeId != 351 && typeId != 416) {
|
||||||
return;
|
return;
|
||||||
@@ -284,6 +283,10 @@ public class ResidencePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (player.getItemInHand().getTypeId() == plugin.getConfigManager().getSelectionTooldID()) {
|
if (player.getItemInHand().getTypeId() == plugin.getConfigManager().getSelectionTooldID()) {
|
||||||
|
if (plugin.getDeny().getStringList("world").contains(player.getWorld().getName())) {
|
||||||
|
player.sendMessage("§c当前世界不允许圈地!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Plugin wep = Bukkit.getPluginManager().getPlugin("WorldEdit");
|
final Plugin wep = Bukkit.getPluginManager().getPlugin("WorldEdit");
|
||||||
if (wep != null) {
|
if (wep != null) {
|
||||||
if (((WorldEditPlugin) wep).getConfig().getInt("wand-item") == plugin.getConfigManager().getSelectionTooldID()) {
|
if (((WorldEditPlugin) wep).getConfig().getInt("wand-item") == plugin.getConfigManager().getSelectionTooldID()) {
|
||||||
@@ -291,19 +294,19 @@ public class ResidencePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
final PermissionGroup group = plugin.getPermissionManager().getGroup(player);
|
final PermissionGroup group = plugin.getPermissionManager().getGroup(player);
|
||||||
if (player.hasPermission("residence.select") || player.hasPermission("residence.create") && !player.isPermissionSet("residence.select")
|
if (player.hasPermission("residence.select")
|
||||||
|| group.canCreateResidences() && !player.isPermissionSet("residence.create") && !player.isPermissionSet("residence.select") || resadmin) {
|
|| player.hasPermission("residence.create") && !player.isPermissionSet("residence.select")
|
||||||
|
|| group.canCreateResidences() && !player.isPermissionSet("residence.create") && !player.isPermissionSet("residence.select")
|
||||||
|
|| resadmin) {
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
final Location loc = block.getLocation();
|
final Location loc = block.getLocation();
|
||||||
plugin.getSelectionManager().placeLoc1(player, loc);
|
plugin.getSelectionManager().placeLoc1(player, loc);
|
||||||
player.sendMessage(ChatColor.GREEN + plugin.getLanguage().getPhrase("SelectPoint", plugin.getLanguage().getPhrase("Primary")) + ChatColor.RED + "(" + loc.getBlockX() + ","
|
player.sendMessage(String.format("§a%s§c(%s,%s,%s)§a!", plugin.getLanguage().getPhrase("SelectPoint", plugin.getLanguage().getPhrase("Primary")), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||||
+ loc.getBlockY() + "," + loc.getBlockZ() + ")" + ChatColor.GREEN + "!");
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
final Location loc = block.getLocation();
|
final Location loc = block.getLocation();
|
||||||
plugin.getSelectionManager().placeLoc2(player, loc);
|
plugin.getSelectionManager().placeLoc2(player, loc);
|
||||||
player.sendMessage(ChatColor.GREEN + plugin.getLanguage().getPhrase("SelectPoint", plugin.getLanguage().getPhrase("Secondary")) + ChatColor.RED + "(" + loc.getBlockX() + ","
|
player.sendMessage(String.format("§a%s§c(%s,%s,%s)§a!", plugin.getLanguage().getPhrase("Secondary", plugin.getLanguage().getPhrase("Primary")), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||||
+ loc.getBlockY() + "," + loc.getBlockZ() + ")" + ChatColor.GREEN + "!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,8 +327,8 @@ public class ResidencePlayerListener implements Listener {
|
|||||||
if (heldItem != null) {
|
if (heldItem != null) {
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (player.getItemInHand().getTypeId() == 351) {
|
if (player.getItemInHand().getTypeId() == 351) {
|
||||||
if (player.getItemInHand().getData().getData() == 15 && block.getType() == Material.GRASS || player.getItemInHand().getData().getData() == 3 && block.getTypeId() == 17
|
if (player.getItemInHand().getData().getData() == 15 && block.getType() == Material.GRASS
|
||||||
&& (block.getData() == 3 || block.getData() == 7 || block.getData() == 11 || block.getData() == 15)) {
|
|| player.getItemInHand().getData().getData() == 3 && block.getTypeId() == 17 && (block.getData() == 3 || block.getData() == 7 || block.getData() == 11 || block.getData() == 15)) {
|
||||||
perms = plugin.getPermsByLocForPlayer(block.getRelative(event.getBlockFace()).getLocation(), player);
|
perms = plugin.getPermsByLocForPlayer(block.getRelative(event.getBlockFace()).getLocation(), player);
|
||||||
if (!perms.playerHas(player.getName(), world, "build", true)) {
|
if (!perms.playerHas(player.getName(), world, "build", true)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@@ -500,8 +503,9 @@ public class ResidencePlayerListener implements Listener {
|
|||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final ClaimedResidence res = plugin.getResidenceManager().getByLoc(loc);
|
final ClaimedResidence res = plugin.getResidenceManager().getByLoc(loc);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
if (plugin.isResAdminOn(player) || ((res.getPermissions().playerHas(player.getName(), "tp", true) || player.hasPermission("residence.admin.tp"))
|
if (plugin.isResAdminOn(player)
|
||||||
&& (res.getPermissions().playerHas(player.getName(), "move", true) || player.hasPermission("residence.admin.move")))) {
|
|| ((res.getPermissions().playerHas(player.getName(), "tp", true) || player.hasPermission("residence.admin.tp"))
|
||||||
|
&& (res.getPermissions().playerHas(player.getName(), "move", true) || player.hasPermission("residence.admin.move")))) {
|
||||||
handleNewLocation(player, loc, false);
|
handleNewLocation(player, loc, false);
|
||||||
} else if (event.getCause() != TeleportCause.PLUGIN) {
|
} else if (event.getCause() != TeleportCause.PLUGIN) {
|
||||||
final String areaname = res.getName();
|
final String areaname = res.getName();
|
||||||
@@ -527,21 +531,48 @@ public class ResidencePlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCanUseEntity_BothClick(final Material mat, final Block block) {
|
private boolean isCanUseEntity_BothClick(final Material mat, final Block block) {
|
||||||
return mat == Material.LEVER || mat == Material.STONE_BUTTON || mat == Material.WOOD_BUTTON || mat == Material.WOODEN_DOOR || mat == Material.TRAP_DOOR || mat == Material.FENCE_GATE
|
return mat == Material.LEVER
|
||||||
|| mat == Material.PISTON_BASE || mat == Material.PISTON_STICKY_BASE || mat == Material.DRAGON_EGG || plugin.getConfigManager().getCustomBothClick().contains(block.getTypeId())
|
|| mat == Material.STONE_BUTTON
|
||||||
|| (plugin.isGt1_8() && (mat == Material.SPRUCE_DOOR || mat == Material.BIRCH_DOOR || mat == Material.JUNGLE_DOOR || mat == Material.ACACIA_DOOR || mat == Material.DARK_OAK_DOOR
|
|| mat == Material.WOOD_BUTTON
|
||||||
|| mat == Material.SPRUCE_FENCE_GATE || mat == Material.BIRCH_FENCE_GATE || mat == Material.JUNGLE_FENCE_GATE || mat == Material.ACACIA_FENCE_GATE
|
|| mat == Material.WOODEN_DOOR
|
||||||
|| mat == Material.DARK_OAK_FENCE_GATE));
|
|| mat == Material.TRAP_DOOR
|
||||||
|
|| mat == Material.FENCE_GATE
|
||||||
|
|| mat == Material.PISTON_BASE
|
||||||
|
|| mat == Material.PISTON_STICKY_BASE
|
||||||
|
|| mat == Material.DRAGON_EGG
|
||||||
|
|| plugin.getConfigManager().getCustomBothClick().contains(block.getTypeId())
|
||||||
|
|| (plugin.isGt1_8()
|
||||||
|
&& (mat == Material.SPRUCE_DOOR
|
||||||
|
|| mat == Material.BIRCH_DOOR
|
||||||
|
|| mat == Material.JUNGLE_DOOR
|
||||||
|
|| mat == Material.ACACIA_DOOR
|
||||||
|
|| mat == Material.DARK_OAK_DOOR
|
||||||
|
|| mat == Material.SPRUCE_FENCE_GATE
|
||||||
|
|| mat == Material.BIRCH_FENCE_GATE
|
||||||
|
|| mat == Material.JUNGLE_FENCE_GATE
|
||||||
|
|| mat == Material.ACACIA_FENCE_GATE
|
||||||
|
|| mat == Material.DARK_OAK_FENCE_GATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCanUseEntity_RClickOnly(final Material mat, final Block block) {
|
private boolean isCanUseEntity_RClickOnly(final Material mat, final Block block) {
|
||||||
return mat == Material.ITEM_FRAME || mat == Material.BEACON || mat == Material.FLOWER_POT || mat == Material.COMMAND || mat == Material.ANVIL || mat == Material.CAKE_BLOCK
|
return mat == Material.ITEM_FRAME
|
||||||
|| mat == Material.NOTE_BLOCK || mat == Material.DIODE || mat == Material.DIODE_BLOCK_OFF || mat == Material.DIODE_BLOCK_ON || mat == Material.BED_BLOCK || mat == Material.WORKBENCH
|
|| mat == Material.BEACON
|
||||||
|| mat == Material.BREWING_STAND || mat == Material.ENCHANTMENT_TABLE || plugin.getConfigManager().getCustomRightClick().contains(block.getTypeId());
|
|| mat == Material.FLOWER_POT
|
||||||
|
|| mat == Material.COMMAND
|
||||||
|
|| mat == Material.ANVIL
|
||||||
|
|| mat == Material.CAKE_BLOCK
|
||||||
|
|| mat == Material.NOTE_BLOCK
|
||||||
|
|| mat == Material.DIODE
|
||||||
|
|| mat == Material.DIODE_BLOCK_OFF
|
||||||
|
|| mat == Material.DIODE_BLOCK_ON
|
||||||
|
|| mat == Material.BED_BLOCK
|
||||||
|
|| mat == Material.WORKBENCH
|
||||||
|
|| mat == Material.BREWING_STAND
|
||||||
|
|| mat == Material.ENCHANTMENT_TABLE
|
||||||
|
|| plugin.getConfigManager().getCustomRightClick().contains(block.getTypeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isContainer(final Material mat, final Block block) {
|
private boolean isContainer(final Material mat, final Block block) {
|
||||||
return FlagPermissions.getMaterialUseFlagList().containsKey(mat) && FlagPermissions.getMaterialUseFlagList().get(mat).equals("container")
|
return FlagPermissions.getMaterialUseFlagList().containsKey(mat) && FlagPermissions.getMaterialUseFlagList().get(mat).equals("container") || plugin.getConfigManager().getCustomContainers().contains(block.getTypeId());
|
||||||
|| plugin.getConfigManager().getCustomContainers().contains(block.getTypeId());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
src/main/resources/deny.yml
Normal file
3
src/main/resources/deny.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#禁止圈地的世界(将会禁止命令和选择)
|
||||||
|
world:
|
||||||
|
- 'denyworld'
|
||||||
Reference in New Issue
Block a user