1
0
mirror of https://e.coding.net/circlecloud/Residence.git synced 2025-11-24 21:46:16 +00:00

整理代码 清理无效return...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092
2015-12-12 11:55:00 +08:00
parent dd4b04ce68
commit c0f233b4de
16 changed files with 1682 additions and 1751 deletions

View File

@@ -205,9 +205,8 @@ public class ResidenceMain extends JavaPlugin {
final ClaimedResidence res = rmanager.getByLoc(loc);
if (res != null) {
return res.getPermissions();
} else {
return wmanager.getPerms(loc.getWorld().getName());
}
return wmanager.getPerms(loc.getWorld().getName());
}
public FlagPermissions getPermsByLocForPlayer(final Location loc, final Player player) {
@@ -692,14 +691,13 @@ public class ResidenceMain extends JavaPlugin {
}
if (cmanager.getResidenceNameRegex() == null) {
return true;
} else {
}
final String namecheck = name.replaceAll(cmanager.getResidenceNameRegex(), "");
if (!name.equals(namecheck)) {
return false;
}
return true;
}
}
private boolean checkNewLanguageVersion(final String lang) throws IOException, FileNotFoundException, InvalidConfigurationException {
final File outFile = new File(new File(this.getDataFolder(), "Language"), lang + ".yml");

View File

@@ -50,7 +50,6 @@ public class CommandLease extends BaseCommand {
} else {
player.sendMessage(ChatColor.RED + language.getPhrase("LeaseNotExpire"));
}
return;
} else {
final String area = rmanager.getNameByLoc(player.getLocation());
final ClaimedResidence res = rmanager.getByName(area);
@@ -64,7 +63,6 @@ public class CommandLease extends BaseCommand {
} else {
player.sendMessage(ChatColor.RED + language.getPhrase("LeaseNotExpire"));
}
return;
}
}
} else if (args.length == 3) {
@@ -80,7 +78,6 @@ public class CommandLease extends BaseCommand {
} else {
player.sendMessage(ChatColor.RED + language.getPhrase("LeaseNotExpire"));
}
return;
} else {
int days;
try {
@@ -90,7 +87,6 @@ public class CommandLease extends BaseCommand {
return;
}
leasemanager.setExpireTime(player, args[1], days);
return;
}
}
}

View File

@@ -45,7 +45,6 @@ public class CommandRemove extends BaseCommand {
} else {
rmanager.removeResidence(player, area, resadmin);
}
return;
} else {
if (!deleteConfirm.containsKey(player.getName()) || !area.equalsIgnoreCase(deleteConfirm.get(player.getName()))) {
player.sendMessage(ChatColor.RED + language.getPhrase("DeleteConfirm", ChatColor.YELLOW + area + ChatColor.RED));
@@ -53,8 +52,8 @@ public class CommandRemove extends BaseCommand {
} else {
rmanager.removeResidence(player, area, resadmin);
}
return;
}
return;
}
}
if (args.length != 1) {

View File

@@ -59,10 +59,8 @@ public class CommandSubZone extends BaseCommand {
return;
}
res.addSubzone(player, smanager.getPlayerLoc1(player.getName()), smanager.getPlayerLoc2(player.getName()), zname, resadmin);
return;
} else {
player.sendMessage(ChatColor.RED + language.getPhrase("SelectPoints"));
return;
}
}

View File

@@ -18,73 +18,74 @@ public class EssentialsEcoAdapter implements EconomyInterface {
Essentials plugin;
public EssentialsEcoAdapter(Essentials p) {
public EssentialsEcoAdapter(final Essentials p) {
plugin = p;
String serverland = "Server Land";
final String serverland = "Server Land";
if (!Economy.playerExists(serverland)) {
Economy.createNPC(serverland);
}
}
@Override
public double getBalance(String playerName) {
try {
public boolean add(final String playerName, final double amount) {
if (Economy.playerExists(playerName)) {
return Economy.getMoney(playerName);
} else {
return 0;
try {
Economy.add(playerName, amount);
return true;
} catch (final UserDoesNotExistException ex) {
return false;
} catch (final NoLoanPermittedException ex) {
return false;
}
} catch (UserDoesNotExistException ex) {
return 0;
}
return false;
}
@Override
public boolean canAfford(String playerName, double amount) {
public boolean canAfford(final String playerName, final double amount) {
try {
if (Economy.playerExists(playerName)) {
return Economy.hasEnough(playerName, amount);
}
return false;
} catch (UserDoesNotExistException ex) {
} catch (final UserDoesNotExistException ex) {
return false;
}
}
@Override
public boolean add(String playerName, double amount) {
if (Economy.playerExists(playerName)) {
public double getBalance(final String playerName) {
try {
Economy.add(playerName, amount);
return true;
} catch (UserDoesNotExistException ex) {
return false;
} catch (NoLoanPermittedException ex) {
return false;
if (Economy.playerExists(playerName)) {
return Economy.getMoney(playerName);
}
} else {
return false;
} catch (final UserDoesNotExistException ex) {
}
return 0;
}
@Override
public boolean subtract(String playerName, double amount) {
public String getName() {
return "EssentialsEconomy";
}
@Override
public boolean subtract(final String playerName, final double amount) {
if (Economy.playerExists(playerName)) {
try {
Economy.subtract(playerName, amount);
return true;
} catch (UserDoesNotExistException ex) {
} catch (final UserDoesNotExistException ex) {
return false;
} catch (NoLoanPermittedException ex) {
} catch (final NoLoanPermittedException ex) {
return false;
}
} else {
return false;
}
return false;
}
@Override
public boolean transfer(String playerFrom, String playerTo, double amount) {
public boolean transfer(final String playerFrom, final String playerTo, final double amount) {
try {
if (Economy.playerExists(playerFrom) && Economy.playerExists(playerTo) && Economy.hasEnough(playerFrom, amount)) {
if (!subtract(playerFrom, amount))
@@ -95,15 +96,10 @@ public class EssentialsEcoAdapter implements EconomyInterface {
}
return true;
}
} catch (UserDoesNotExistException ex) {
} catch (final UserDoesNotExistException ex) {
return false;
}
return false;
}
@Override
public String getName() {
return "EssentialsEconomy";
}
}

View File

@@ -4,13 +4,13 @@
*/
package cn.citycraft.Residence.itemlist;
import org.bukkit.ChatColor;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
@@ -21,130 +21,69 @@ import org.bukkit.entity.Player;
*/
public class ItemList {
public static enum ListType {
BLACKLIST,
WHITELIST,
IGNORELIST,
OTHER
}
protected List<Material> list;
protected ListType type;
public ItemList(ListType listType)
{
public ItemList(final ListType listType) {
this();
type = listType;
}
protected ItemList()
{
protected ItemList() {
list = new ArrayList<Material>();
}
public static enum ListType
{
BLACKLIST,WHITELIST,IGNORELIST,OTHER
public static ItemList load(final Map<String, Object> map) {
final ItemList newlist = new ItemList();
return load(map, newlist);
}
public ListType getType()
{
return type;
}
public boolean contains(Material mat)
{
return list.contains(mat);
}
public void add(Material mat)
{
if(!list.contains(mat))
list.add(mat);
}
public boolean toggle(Material mat)
{
if(list.contains(mat))
{
list.remove(mat);
return false;
}
else
{
list.add(mat);
return true;
}
}
public void remove(Material mat)
{
list.remove(mat);
}
public boolean isAllowed(Material mat)
{
if(type == ListType.BLACKLIST)
{
if(list.contains(mat))
{
return false;
}
return true;
}
else if(type == ListType.WHITELIST)
{
if(list.contains(mat))
{
return true;
}
return false;
}
return true;
}
public boolean isIgnored(Material mat)
{
if(type == ListType.IGNORELIST)
{
if(list.contains(mat))
{
return true;
}
}
return false;
}
public boolean isListed(Material mat)
{
return this.contains(mat);
}
public int getListSize()
{
return list.size();
}
public static ItemList readList(ConfigurationSection node)
{
public static ItemList readList(final ConfigurationSection node) {
return ItemList.readList(node, new ItemList());
}
@SuppressWarnings("unchecked")
protected static ItemList load(final Map<String, Object> map, final ItemList newlist) {
try {
newlist.type = ListType.valueOf((String) map.get("Type"));
final List<String> list = (List<String>) map.get("ItemList");
for (final String item : list) {
newlist.add(Material.valueOf(item));
}
} catch (final Exception ex) {
}
return newlist;
}
@SuppressWarnings("deprecation")
protected static ItemList readList(ConfigurationSection node, ItemList list)
{
ListType type = ListType.valueOf(node.getString("Type","").toUpperCase());
protected static ItemList readList(final ConfigurationSection node, final ItemList list) {
final ListType type = ListType.valueOf(node.getString("Type", "").toUpperCase());
list.type = type;
List<String> items = node.getStringList("Items");
final List<String> items = node.getStringList("Items");
if (items != null) {
for (String item : items) {
for (final String item : items) {
int parse = -1;
try {
parse = Integer.parseInt(item);
} catch (Exception ex) {
} catch (final Exception ex) {
}
if (parse == -1) {
try {
list.add(Material.valueOf(item.toUpperCase()));
} catch (Exception ex) {
} catch (final Exception ex) {
}
} else {
try {
list.add(Material.getMaterial(parse));
} catch (Exception ex) {
} catch (final Exception ex) {
}
}
}
@@ -152,12 +91,55 @@ public class ItemList {
return list;
}
public void printList(Player player)
{
StringBuilder builder = new StringBuilder();
public void add(final Material mat) {
if (!list.contains(mat))
list.add(mat);
}
public boolean contains(final Material mat) {
return list.contains(mat);
}
public int getListSize() {
return list.size();
}
public ListType getType() {
return type;
}
public boolean isAllowed(final Material mat) {
if (type == ListType.BLACKLIST) {
if (list.contains(mat)) {
return false;
}
return true;
} else if (type == ListType.WHITELIST) {
if (list.contains(mat)) {
return true;
}
return false;
}
return true;
}
public boolean isIgnored(final Material mat) {
if (type == ListType.IGNORELIST) {
if (list.contains(mat)) {
return true;
}
}
return false;
}
public boolean isListed(final Material mat) {
return this.contains(mat);
}
public void printList(final Player player) {
final StringBuilder builder = new StringBuilder();
boolean first = true;
for(Material mat : list)
{
for (final Material mat : list) {
if (!first)
builder.append(", ");
else
@@ -168,51 +150,37 @@ public class ItemList {
player.sendMessage(builder.toString());
}
public Material[] toArray()
{
Material mats[] = new Material[list.size()];
int i = 0;
for(Material mat : list)
{
mats[i] = mat;
i++;
}
return mats;
public void remove(final Material mat) {
list.remove(mat);
}
public Map<String,Object> save()
{
Map<String, Object> saveMap = new LinkedHashMap<String,Object>();
public Map<String, Object> save() {
final Map<String, Object> saveMap = new LinkedHashMap<String, Object>();
saveMap.put("Type", type.toString());
List<String> saveList = new ArrayList<String>();
for(Material mat : list)
{
final List<String> saveList = new ArrayList<String>();
for (final Material mat : list) {
saveList.add(mat.toString());
}
saveMap.put("ItemList", saveList);
return saveMap;
}
public static ItemList load(Map<String,Object> map)
{
ItemList newlist = new ItemList();
return load(map,newlist);
public Material[] toArray() {
final Material mats[] = new Material[list.size()];
int i = 0;
for (final Material mat : list) {
mats[i] = mat;
i++;
}
return mats;
}
@SuppressWarnings("unchecked")
protected static ItemList load(Map<String,Object> map, ItemList newlist)
{
try
{
newlist.type = ListType.valueOf((String) map.get("Type"));
List<String> list = (List<String>) map.get("ItemList");
for(String item : list)
{
newlist.add(Material.valueOf(item));
}
}
catch (Exception ex)
{}
return newlist;
public boolean toggle(final Material mat) {
if (list.contains(mat)) {
list.remove(mat);
return false;
}
list.add(mat);
return true;
}
}

View File

@@ -351,11 +351,9 @@ public class ResidencePlayerListener implements Listener {
if (hasuse || checkMat.getValue().equals("container")) {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("FlagDeny", checkMat.getValue()));
return;
} else {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("FlagDeny", "use"));
return;
}
}
}
@@ -528,8 +526,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(block.getTypeId())
|| 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));

View File

@@ -83,9 +83,8 @@ public class PermissionManager {
final String group = this.getPermissionsGroup(player, world);
if (group == null || !groups.containsKey(group)) {
return plugin.getConfigManager().getDefaultGroup().toLowerCase();
} else {
return group;
}
return group;
}
public String getPermissionsGroup(final Player player) {
@@ -121,9 +120,8 @@ public class PermissionManager {
perms = vault;
plugin.getLogger().info("发现 Vault 使用权限系统: " + vault.getPermissionsName());
return;
} else {
plugin.getLogger().info("发现 Vault, 但是 Vault 未找到权限系统...");
}
plugin.getLogger().info("发现 Vault, 但是 Vault 未找到权限系统...");
}
}

View File

@@ -8,6 +8,7 @@ package cn.citycraft.Residence.text;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.bukkit.configuration.file.FileConfiguration;
/**
@@ -21,42 +22,38 @@ public class Language {
text = new HashMap<String, String>();
}
public void setText(String key, String intext) {
text.put(key, intext);
public static Language parseText(final FileConfiguration node, final String topkey) {
final Language newholder = new Language();
final Set<String> keys = node.getConfigurationSection(topkey).getKeys(false);
for (final String key : keys) {
newholder.text.put(key, node.getString(topkey + "." + key));
}
return newholder;
}
private String getText(String key) {
String t = text.get(key);
if (t == null) {
t = "<missing language key: " + key + ">";
}
return t;
}
public String getPhrase(String key) {
String[] split = key.split("\\.");
public String getPhrase(final String key) {
final String[] split = key.split("\\.");
return getPhrase(split);
}
public String getPhrase(String[] keys) {
return this.getPhrase(keys, (String[]) null);
}
public String getPhrase(String key, String words) {
public String getPhrase(final String key, final String words) {
return this.getPhrase(key.split("\\."), words);
}
public String getPhrase(String[] keys, String words) {
if (words == null) {
public String getPhrase(final String[] keys) {
return this.getPhrase(keys, (String[]) null);
} else {
return this.getPhrase(keys, words.split("\\."));
}
}
public String getPhrase(String[] keys, String[] words) {
public String getPhrase(final String[] keys, final String words) {
if (words == null) {
return this.getPhrase(keys, (String[]) null);
}
return this.getPhrase(keys, words.split("\\."));
}
public String getPhrase(final String[] keys, final String[] words) {
String sentence = "";
for (String key : keys) {
for (final String key : keys) {
if (sentence.length() == 0) {
sentence = this.getText(key);
} else {
@@ -71,12 +68,15 @@ public class Language {
return sentence;
}
public static Language parseText(FileConfiguration node, String topkey) {
Language newholder = new Language();
Set<String> keys = node.getConfigurationSection(topkey).getKeys(false);
for (String key : keys) {
newholder.text.put(key, node.getString(topkey + "." + key));
public void setText(final String key, final String intext) {
text.put(key, intext);
}
return newholder;
private String getText(final String key) {
String t = text.get(key);
if (t == null) {
t = "<missing language key: " + key + ">";
}
return t;
}
}

View File

@@ -5,16 +5,15 @@
package cn.citycraft.Residence.vaultinterface;
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Server;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import cn.citycraft.Residence.economy.EconomyInterface;
import cn.citycraft.Residence.permissions.PermissionsInterface;
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
/**
*
@@ -26,7 +25,7 @@ public class ResidenceVaultAdapter implements EconomyInterface, PermissionsInter
public static Economy economy = null;
public static Chat chat = null;
public ResidenceVaultAdapter(Server s) {
public ResidenceVaultAdapter(final Server s) {
this.setupPermissions(s);
this.setupEconomy(s);
this.setupChat(s);
@@ -34,13 +33,13 @@ public class ResidenceVaultAdapter implements EconomyInterface, PermissionsInter
@SuppressWarnings("deprecation")
@Override
public boolean add(String playerName, double amount) {
public boolean add(final String playerName, final double amount) {
return economy.depositPlayer(playerName, amount).transactionSuccess();
}
@SuppressWarnings("deprecation")
@Override
public boolean canAfford(String playerName, double amount) {
public boolean canAfford(final String playerName, final double amount) {
return economy.has(playerName, amount);
}
@@ -54,7 +53,7 @@ public class ResidenceVaultAdapter implements EconomyInterface, PermissionsInter
@SuppressWarnings("deprecation")
@Override
public double getBalance(String playerName) {
public double getBalance(final String playerName) {
return economy.getBalance(playerName);
}
@@ -82,21 +81,19 @@ public class ResidenceVaultAdapter implements EconomyInterface, PermissionsInter
}
@Override
public String getPlayerGroup(Player player) {
String group = permissions.getPrimaryGroup(player).toLowerCase();
public String getPlayerGroup(final Player player) {
final String group = permissions.getPrimaryGroup(player).toLowerCase();
if (group == null)
return group;
else
return group.toLowerCase();
}
@Override
@SuppressWarnings("deprecation")
public String getPlayerGroup(String player, String world) {
String group = permissions.getPrimaryGroup(world, player);
public String getPlayerGroup(final String player, final String world) {
final String group = permissions.getPrimaryGroup(world, player);
if (group == null)
return group;
else
return group.toLowerCase();
}
@@ -106,51 +103,45 @@ public class ResidenceVaultAdapter implements EconomyInterface, PermissionsInter
return false;
}
private boolean setupChat(Server s) {
RegisteredServiceProvider<Chat> chatProvider = s.getServicesManager().getRegistration(
net.milkbowl.vault.chat.Chat.class);
@SuppressWarnings("deprecation")
@Override
public boolean subtract(final String playerName, final double amount) {
return economy.withdrawPlayer(playerName, amount).transactionSuccess();
}
@SuppressWarnings("deprecation")
@Override
public boolean transfer(final String playerFrom, final String playerTo, final double amount) {
if (economy.withdrawPlayer(playerFrom, amount).transactionSuccess()) {
if (economy.depositPlayer(playerTo, amount).transactionSuccess())
return true;
economy.depositPlayer(playerFrom, amount);
}
return false;
}
private boolean setupChat(final Server s) {
final RegisteredServiceProvider<Chat> chatProvider = s.getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
if (chatProvider != null) {
chat = chatProvider.getProvider();
}
return (chat != null);
}
private boolean setupEconomy(Server s) {
RegisteredServiceProvider<Economy> economyProvider = s.getServicesManager()
.getRegistration(net.milkbowl.vault.economy.Economy.class);
private boolean setupEconomy(final Server s) {
final RegisteredServiceProvider<Economy> economyProvider = s.getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
economy = economyProvider.getProvider();
}
return (economy != null);
}
private boolean setupPermissions(Server s) {
RegisteredServiceProvider<Permission> permissionProvider = s.getServicesManager()
.getRegistration(net.milkbowl.vault.permission.Permission.class);
private boolean setupPermissions(final Server s) {
final RegisteredServiceProvider<Permission> permissionProvider = s.getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null) {
permissions = permissionProvider.getProvider();
}
return (permissions != null);
}
@SuppressWarnings("deprecation")
@Override
public boolean subtract(String playerName, double amount) {
return economy.withdrawPlayer(playerName, amount).transactionSuccess();
}
@SuppressWarnings("deprecation")
@Override
public boolean transfer(String playerFrom, String playerTo, double amount) {
if (economy.withdrawPlayer(playerFrom, amount).transactionSuccess()) {
if (economy.depositPlayer(playerTo, amount).transactionSuccess())
return true;
else {
economy.depositPlayer(playerFrom, amount);
return false;
}
} else
return false;
}
}

View File

@@ -88,9 +88,8 @@ public class Residence {
final ClaimedResidence res = getResidenceManager().getByLoc(loc);
if (res != null) {
return res.getPermissions();
} else {
return getWorldFlags().getPerms(loc.getWorld().getName());
}
return getWorldFlags().getPerms(loc.getWorld().getName());
}
public static FlagPermissions getPermsByLocForPlayer(final Location loc, final Player player) {

View File

@@ -221,9 +221,8 @@ public class ClaimedResidence {
public boolean addSubzone(final Player player, final Location loc1, final Location loc2, final String name, final boolean resadmin) {
if (player == null) {
return this.addSubzone(null, "Server Land", loc1, loc2, name, resadmin);
} else {
return this.addSubzone(player, player.getName(), loc1, loc2, name, resadmin);
}
return this.addSubzone(player, player.getName(), loc1, loc2, name, resadmin);
}
public boolean addSubzone(final Player player, final String owner, final Location loc1, final Location loc2, final String name, final boolean resadmin) {
@@ -292,13 +291,12 @@ public class ClaimedResidence {
player.sendMessage(ChatColor.GREEN + plugin.getLanguage().getPhrase("SubzoneCreate", ChatColor.YELLOW + name));
}
return true;
} else {
}
if (player != null) {
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("SubzoneCreateFail", ChatColor.YELLOW + name));
}
return false;
}
}
public boolean addSubzone(final String name, final Location loc1, final Location loc2) {
return this.addSubzone(null, loc1, loc2, name, true);
@@ -428,14 +426,13 @@ public class ClaimedResidence {
}
if (found) {
return newLoc;
} else {
}
final World world = Bukkit.getServer().getWorld(perms.getWorld());
if (world != null) {
return world.getSpawnLocation();
}
return insideLoc;
}
}
public String getOwner() {
return perms.getOwner();
@@ -690,11 +687,10 @@ public class ClaimedResidence {
player.sendMessage(ChatColor.GREEN + plugin.getLanguage().getPhrase("AreaRename", oldName + "." + newName));
}
return true;
} else {
}
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("NoPermission"));
return false;
}
}
public boolean renameArea(final String oldName, final String newName) {
return this.renameArea(null, oldName, newName, true);

View File

@@ -27,8 +27,14 @@ import cn.citycraft.Residence.ResidenceMain;
*/
public class FlagPermissions {
protected static ResidenceMain plugin;
public static enum FlagState {
FALSE,
INVALID,
NEITHER,
TRUE
}
protected static ResidenceMain plugin;
protected static ArrayList<String> validAreaFlags = new ArrayList<String>();
protected static HashMap<String, ArrayList<String>> validFlagGroups = new HashMap<String, ArrayList<String>>();
protected static ArrayList<String> validFlags = new ArrayList<String>();
@@ -37,6 +43,7 @@ public class FlagPermissions {
protected Map<String, Boolean> cuboidFlags;
protected Map<String, Map<String, Boolean>> groupFlags;
protected FlagPermissions parent;
protected Map<String, Map<String, Boolean>> playerFlags;
public FlagPermissions() {
@@ -457,9 +464,8 @@ public class FlagPermissions {
sbuild.append("none");
}
return sbuild.toString();
} else {
return "none";
}
return "none";
}
public String listOtherPlayersFlags(String player) {
@@ -509,9 +515,8 @@ public class FlagPermissions {
sbuild.append("none");
}
return sbuild.toString();
} else {
return "none";
}
return "none";
}
public boolean playerHas(final String player, final String world, final String flag, final boolean def) {
@@ -627,11 +632,4 @@ public class FlagPermissions {
}
return def;
}
public static enum FlagState {
FALSE,
INVALID,
NEITHER,
TRUE
}
}

View File

@@ -25,8 +25,8 @@ import org.bukkit.plugin.PluginManager;
import com.bekvon.bukkit.residence.event.ResidenceCreationEvent;
import com.bekvon.bukkit.residence.event.ResidenceDeleteEvent;
import com.bekvon.bukkit.residence.event.ResidenceRenameEvent;
import com.bekvon.bukkit.residence.event.ResidenceDeleteEvent.DeleteCause;
import com.bekvon.bukkit.residence.event.ResidenceRenameEvent;
import cn.citycraft.Residence.ResidenceMain;
import cn.citycraft.Residence.permissions.PermissionGroup;
@@ -545,11 +545,13 @@ public class ResidenceManager {
player.sendMessage(ChatColor.YELLOW + plugin.getLanguage().getPhrase("Total.Size") + ":" + ChatColor.LIGHT_PURPLE + " " + res.getTotalSize());
if (aid != null) {
player.sendMessage(ChatColor.YELLOW + plugin.getLanguage().getPhrase("CoordsT") + ": " + ChatColor.LIGHT_PURPLE
+ plugin.getLanguage().getPhrase("CoordsTop", res.getAreaByLoc(player.getLocation()).getHighLoc().getBlockX() + "."
+ res.getAreaByLoc(player.getLocation()).getHighLoc().getBlockY() + "." + res.getAreaByLoc(player.getLocation()).getHighLoc().getBlockZ()));
+ plugin.getLanguage().getPhrase("CoordsTop",
res.getAreaByLoc(player.getLocation()).getHighLoc().getBlockX() + "." + res.getAreaByLoc(player.getLocation()).getHighLoc().getBlockY() + "."
+ res.getAreaByLoc(player.getLocation()).getHighLoc().getBlockZ()));
player.sendMessage(ChatColor.YELLOW + plugin.getLanguage().getPhrase("CoordsB") + ": " + ChatColor.LIGHT_PURPLE
+ plugin.getLanguage().getPhrase("CoordsBottom", res.getAreaByLoc(player.getLocation()).getLowLoc().getBlockX() + "."
+ res.getAreaByLoc(player.getLocation()).getLowLoc().getBlockY() + "." + res.getAreaByLoc(player.getLocation()).getLowLoc().getBlockZ()));
+ plugin.getLanguage().getPhrase("CoordsBottom",
res.getAreaByLoc(player.getLocation()).getLowLoc().getBlockX() + "." + res.getAreaByLoc(player.getLocation()).getLowLoc().getBlockY() + "."
+ res.getAreaByLoc(player.getLocation()).getLowLoc().getBlockZ()));
if (plugin.isUseWorldEdit()) {
WECUI.UPDATESELECT(res, player);
}
@@ -683,18 +685,16 @@ public class ResidenceManager {
ChatColor.GREEN + plugin.getLanguage().getPhrase("ResidenceRename", ChatColor.YELLOW + oldName + ChatColor.GREEN + "." + ChatColor.YELLOW + newName + ChatColor.GREEN));
}
return true;
} else {
}
final String[] oldname = oldName.split("\\.");
final ClaimedResidence parent = res.getParent();
return parent.renameSubzone(player, oldname[oldname.length - 1], newName, resadmin);
}
} else {
if (player != null) {
player.sendMessage(ChatColor.RED + plugin.getLanguage().getPhrase("NoPermission"));
}
return false;
}
}
public boolean renameResidence(final String oldName, final String newName) {
return this.renameResidence(null, oldName, newName, true);
@@ -719,8 +719,7 @@ public class ResidenceManager {
return worldmap;
}
private void getResidenceList(final String targetplayer, final boolean showhidden, final boolean showsubzones, final String parentzone, final String resname, final ClaimedResidence res,
final ArrayList<String> list, final boolean formattedOutput) {
private void getResidenceList(final String targetplayer, final boolean showhidden, final boolean showsubzones, final String parentzone, final String resname, final ClaimedResidence res, final ArrayList<String> list, final boolean formattedOutput) {
final boolean hidden = res.getPermissions().has("hidden", false);
if ((showhidden) || (!showhidden && !hidden)) {
if (targetplayer == null || res.getPermissions().getOwner().equalsIgnoreCase(targetplayer)) {

View File

@@ -18,8 +18,8 @@ import org.bukkit.plugin.PluginManager;
import com.bekvon.bukkit.residence.event.ResidenceFlagChangeEvent;
import com.bekvon.bukkit.residence.event.ResidenceFlagCheckEvent;
import com.bekvon.bukkit.residence.event.ResidenceOwnerChangeEvent;
import com.bekvon.bukkit.residence.event.ResidenceFlagEvent.FlagType;
import com.bekvon.bukkit.residence.event.ResidenceOwnerChangeEvent;
import cn.citycraft.Residence.ResidenceMain;
import cn.citycraft.Residence.permissions.PermissionGroup;
@@ -260,9 +260,8 @@ public class ResidencePermissions extends FlagPermissions {
final String renter = plugin.getRentManager().getRentingPlayer(resname);
if (player.getName().equalsIgnoreCase(renter)) {
return true;
} else {
return (playerHas(player.getName(), "admin", false));
}
return (playerHas(player.getName(), "admin", false));
}
}
if (requireOwner) {

View File

@@ -45,9 +45,8 @@ public class WorldFlagManager {
if (list == null) {
if (globaldefaults == null) {
return new FlagPermissions();
} else {
return globaldefaults;
}
return globaldefaults;
}
return list;
}