mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
尝试修复领地卡TP的BUG...
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
* To change this template, choose Tools | Templates and open the template in
|
||||
* the editor.
|
||||
*/
|
||||
|
||||
package cn.citycraft.Residence.listeners;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -63,10 +62,10 @@ public class ResidencePlayerListener implements Listener {
|
||||
|
||||
public ResidencePlayerListener(final ResidenceMain plugin) {
|
||||
this.plugin = plugin;
|
||||
currentRes = new HashMap<String, String>();
|
||||
lastUpdate = new HashMap<String, Long>();
|
||||
lastOutsideLoc = new HashMap<String, Location>();
|
||||
playerToggleChat = new ArrayList<String>();
|
||||
currentRes = new HashMap<>();
|
||||
lastUpdate = new HashMap<>();
|
||||
lastOutsideLoc = new HashMap<>();
|
||||
playerToggleChat = new ArrayList<>();
|
||||
minUpdateTime = plugin.getConfigManager().getMinMoveUpdateInterval();
|
||||
chatenabled = plugin.getConfigManager().chatEnabled();
|
||||
for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
@@ -119,8 +118,7 @@ public class ResidencePlayerListener implements Listener {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (move && !res.getPermissions().playerHas(pname, "move", true) && !plugin.isResAdminOn(player) && !player.hasPermission("residence.admin.move")
|
||||
&& !player.hasPermission("residence.admin.tp")) {
|
||||
if (move && !res.getPermissions().playerHas(pname, "move", true) && !plugin.isResAdminOn(player) && !player.hasPermission("residence.admin.move")) {
|
||||
final Location lastLoc = lastOutsideLoc.get(pname);
|
||||
if (lastLoc != null) {
|
||||
player.teleport(lastLoc);
|
||||
@@ -362,14 +360,14 @@ public class ResidencePlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plugin.getConfigManager().getCustomContainers().contains(Integer.valueOf(block.getTypeId()))) {
|
||||
if (plugin.getConfigManager().getCustomContainers().contains(block.getTypeId())) {
|
||||
if (!perms.playerHas(player.getName(), world, "container", hasuse)) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("FlagDeny", "container"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (plugin.getConfigManager().getCustomBothClick().contains(Integer.valueOf(block.getTypeId()))) {
|
||||
if (plugin.getConfigManager().getCustomBothClick().contains(block.getTypeId())) {
|
||||
if (!hasuse) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("FlagDeny", "use"));
|
||||
@@ -377,11 +375,10 @@ public class ResidencePlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (plugin.getConfigManager().getCustomRightClick().contains(Integer.valueOf(block.getTypeId()))) {
|
||||
if (plugin.getConfigManager().getCustomRightClick().contains(block.getTypeId())) {
|
||||
if (!hasuse) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("FlagDeny", "use"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -406,7 +403,6 @@ public class ResidencePlayerListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/* Container - ItemFrame protection */
|
||||
final Material heldItem = player.getItemInHand().getType();
|
||||
if (!(ent instanceof Hanging)) {
|
||||
@@ -511,7 +507,6 @@ public class ResidencePlayerListener implements Listener {
|
||||
final String areaname = res.getName();
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("TeleportDeny", areaname));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,7 +529,7 @@ public class ResidencePlayerListener implements Listener {
|
||||
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
|
||||
|| mat == Material.PISTON_BASE || mat == Material.PISTON_STICKY_BASE || mat == Material.DRAGON_EGG
|
||||
|| plugin.getConfigManager().getCustomBothClick().contains(Integer.valueOf(block.getTypeId()))
|
||||
|| 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));
|
||||
@@ -543,11 +538,11 @@ public class ResidencePlayerListener implements Listener {
|
||||
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
|
||||
|| 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(Integer.valueOf(block.getTypeId()));
|
||||
|| mat == Material.BREWING_STAND || mat == Material.ENCHANTMENT_TABLE || plugin.getConfigManager().getCustomRightClick().contains(block.getTypeId());
|
||||
}
|
||||
|
||||
private boolean isContainer(final Material mat, final Block block) {
|
||||
return FlagPermissions.getMaterialUseFlagList().containsKey(mat) && FlagPermissions.getMaterialUseFlagList().get(mat).equals("container")
|
||||
|| plugin.getConfigManager().getCustomContainers().contains(Integer.valueOf(block.getTypeId()));
|
||||
|| plugin.getConfigManager().getCustomContainers().contains(block.getTypeId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ import cn.citycraft.Residence.text.help.InformationPager;
|
||||
public class ClaimedResidence {
|
||||
|
||||
protected Map<String, CuboidArea> areas;
|
||||
|
||||
protected ResidenceBank bank;
|
||||
protected ResidenceItemList blacklist;
|
||||
protected String enterMessage;
|
||||
@@ -62,14 +61,14 @@ public class ClaimedResidence {
|
||||
|
||||
private ClaimedResidence(final ResidenceMain plugin) {
|
||||
this.plugin = plugin;
|
||||
subzones = new HashMap<String, ClaimedResidence>();
|
||||
areas = new HashMap<String, CuboidArea>();
|
||||
subzones = new HashMap<>();
|
||||
areas = new HashMap<>();
|
||||
bank = new ResidenceBank(plugin, this);
|
||||
blacklist = new ResidenceItemList(plugin, this, ListType.BLACKLIST);
|
||||
ignorelist = new ResidenceItemList(plugin, this, ListType.IGNORELIST);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static ClaimedResidence load(final ResidenceMain plugin, final Map root, final ClaimedResidence parent) throws Exception {
|
||||
final ClaimedResidence res = new ClaimedResidence(plugin);
|
||||
if (root == null) {
|
||||
@@ -451,7 +450,7 @@ public class ClaimedResidence {
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPlayersInResidence() {
|
||||
final ArrayList<Player> within = new ArrayList<Player>();
|
||||
final ArrayList<Player> within = new ArrayList<>();
|
||||
for (final Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (containsLoc(player.getLocation())) {
|
||||
within.add(player);
|
||||
@@ -500,7 +499,7 @@ public class ClaimedResidence {
|
||||
}
|
||||
|
||||
public String[] getSubzoneList() {
|
||||
final ArrayList<String> zones = new ArrayList<String>();
|
||||
final ArrayList<String> zones = new ArrayList<>();
|
||||
final Set<String> set = subzones.keySet();
|
||||
for (final String key : set) {
|
||||
if (key != null) {
|
||||
@@ -589,7 +588,7 @@ public class ClaimedResidence {
|
||||
}
|
||||
|
||||
public void printAdvancedAreaList(final Player player, final int page) {
|
||||
final ArrayList<String> temp = new ArrayList<String>();
|
||||
final ArrayList<String> temp = new ArrayList<>();
|
||||
for (final Entry<String, CuboidArea> entry : areas.entrySet()) {
|
||||
final CuboidArea a = entry.getValue();
|
||||
final Location h = a.getHighLoc();
|
||||
@@ -602,7 +601,7 @@ public class ClaimedResidence {
|
||||
}
|
||||
|
||||
public void printAreaList(final Player player, final int page) {
|
||||
final ArrayList<String> temp = new ArrayList<String>();
|
||||
final ArrayList<String> temp = new ArrayList<>();
|
||||
for (final String area : areas.keySet()) {
|
||||
temp.add(area);
|
||||
}
|
||||
@@ -610,7 +609,7 @@ public class ClaimedResidence {
|
||||
}
|
||||
|
||||
public void printSubzoneList(final Player player, final int page) {
|
||||
final ArrayList<String> temp = new ArrayList<String>();
|
||||
final ArrayList<String> temp = new ArrayList<>();
|
||||
for (final Entry<String, ClaimedResidence> sz : subzones.entrySet()) {
|
||||
temp.add(ChatColor.GREEN + sz.getKey() + ChatColor.YELLOW + " - " + plugin.getLanguage().getPhrase("Owner") + ": " + sz.getValue().getOwner());
|
||||
}
|
||||
@@ -850,8 +849,8 @@ public class ClaimedResidence {
|
||||
}
|
||||
|
||||
public Map<String, Object> save() {
|
||||
final Map<String, Object> root = new HashMap<String, Object>();
|
||||
final Map<String, Object> areamap = new HashMap<String, Object>();
|
||||
final Map<String, Object> root = new HashMap<>();
|
||||
final Map<String, Object> areamap = new HashMap<>();
|
||||
root.put("EnterMessage", enterMessage);
|
||||
root.put("LeaveMessage", leaveMessage);
|
||||
root.put("StoredMoney", bank.getStoredMoney());
|
||||
@@ -861,14 +860,14 @@ public class ClaimedResidence {
|
||||
areamap.put(entry.getKey(), entry.getValue().save());
|
||||
}
|
||||
root.put("Areas", areamap);
|
||||
final Map<String, Object> subzonemap = new HashMap<String, Object>();
|
||||
final Map<String, Object> subzonemap = new HashMap<>();
|
||||
for (final Entry<String, ClaimedResidence> sz : subzones.entrySet()) {
|
||||
subzonemap.put(sz.getKey(), sz.getValue().save());
|
||||
}
|
||||
root.put("Subzones", subzonemap);
|
||||
root.put("Permissions", perms.save());
|
||||
if (tpLoc != null) {
|
||||
final Map<String, Object> tpmap = new HashMap<String, Object>();
|
||||
final Map<String, Object> tpmap = new HashMap<>();
|
||||
tpmap.put("X", tpLoc.getBlockX());
|
||||
tpmap.put("Y", tpLoc.getBlockY());
|
||||
tpmap.put("Z", tpLoc.getBlockZ());
|
||||
@@ -922,7 +921,7 @@ public class ClaimedResidence {
|
||||
}
|
||||
|
||||
public void tpToResidence(final Player reqPlayer, final Player targetPlayer, final boolean resadmin) {
|
||||
if (!resadmin && !reqPlayer.hasPermission("residence.admin.tp")) {
|
||||
if (!resadmin && !(reqPlayer.hasPermission("residence.admin.tp") && reqPlayer.hasPermission("residence.admin.move"))) {
|
||||
final PermissionGroup group = plugin.getPermissionManager().getGroup(reqPlayer);
|
||||
if (!group.hasTpAccess()) {
|
||||
reqPlayer.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("TeleportDeny"));
|
||||
@@ -932,7 +931,7 @@ public class ClaimedResidence {
|
||||
reqPlayer.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("NoPermission"));
|
||||
return;
|
||||
}
|
||||
if (!this.perms.playerHas(reqPlayer.getName(), "tp", true)) {
|
||||
if (!this.perms.playerHas(reqPlayer.getName(), "tp", true) || !this.perms.playerHas(reqPlayer.getName(), "move", true)) {
|
||||
reqPlayer.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("TeleportNoFlag"));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user