{"action":"closed","issue":{"url":"https://api.github.com/repos/kicjow/Crazy-Enchantments/issues/118","repository_url":"https://api.github.com/repos/kicjow/Crazy-Enchantments","labels_url":"https://api.github.com/repos/kicjow/Crazy-Enchantments/issues/118/labels{/name}","comments_url":"https://api.github.com/repos/kicjow/Crazy-Enchantments/issues/118/comments","events_url":"https://api.github.com/repos/kicjow/Crazy-Enchantments/issues/118/events","html_url":"https://github.com/kicjow/Crazy-Enchantments/issues/118","id":192224061,"number":118,"title":"Add Kingdoms+ ","user":{"login":"downboy","id":5592319,"avatar_url":"https://avatars.githubusercontent.com/u/5592319?v=3","gravatar_id":"","url":"https://api.github.com/users/downboy","html_url":"https://github.com/downboy","followers_url":"https://api.github.com/users/downboy/followers","following_url":"https://api.github.com/users/downboy/following{/other_user}","gists_url":"https://api.github.com/users/downboy/gists{/gist_id}","starred_url":"https://api.github.com/users/downboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/downboy/subscriptions","organizations_url":"https://api.github.com/users/downboy/orgs","repos_url":"https://api.github.com/users/downboy/repos","events_url":"https://api.github.com/users/downboy/events{/privacy}","received_events_url":"https://api.github.com/users/downboy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-29T09:02:22Z","updated_at":"2016-12-01T08:40:46Z","closed_at":"2016-12-01T08:40:46Z","body":"i cant make a Pull request so i will do it in the Issue:\r\n\r\n**Api.java**\r\n\r\n```\r\npublic static boolean hasKingdoms() {\r\n      if (Bukkit.getServer().getPluginManager().getPlugin(\"Kingdoms\") != null) {\r\n      return true;\r\n    }\r\n    return false;\r\n  }\r\n \r\n  public static boolean inTerritory(Player player) {\r\n      Plugin kingdoms = Bukkit.getServer().getPluginManager().getPlugin(\"Kingdoms\");\r\n    if ((kingdoms != null) &&\r\n      (Kingdoms.inTerritory(player))) {\r\n      return true;\r\n    }\r\n   \r\n    return false;\r\n  }\r\n \r\n  public static boolean isFriendly(Entity P, Entity O) {\r\n      if (((P instanceof Player)) && ((O instanceof Player))) {\r\n      Player player = (Player)P;\r\n      Player other = (Player)O;\r\n      Plugin kingdoms = Bukkit.getServer().getPluginManager().getPlugin(\"Kingdoms\");\r\n      if (kingdoms != null) {\r\n        if (Kingdoms.isFriendly(player, other)) return true;\r\n        if (!Kingdoms.isFriendly(player, other)) return false;\r\n      }\r\n    }\r\n    return false;\r\n  }\r\n```\r\n\r\n**Kingdoms.java**\r\n\r\n```\r\npackage me.BadBones69.CrazyEnchantments.MultiSupport;\r\n\r\nimport org.bukkit.block.Block;\r\nimport org.bukkit.entity.Player;\r\nimport org.kingdoms.constants.kingdom.Kingdom;\r\nimport org.kingdoms.constants.land.Land;\r\nimport org.kingdoms.constants.land.SimpleLocation;\r\nimport org.kingdoms.constants.player.KingdomPlayer;\r\nimport org.kingdoms.manager.game.GameManagement;\r\n\r\npublic class Kingdoms {\r\n    public static boolean isFriendly(Player player, Player other){\r\n        KingdomPlayer kp = GameManagement.getPlayerManager().getSession(player);\r\n        KingdomPlayer ko = GameManagement.getPlayerManager().getSession(other);\r\n       \r\n        if (kp.getKingdom() != null){\r\n            if (kp.getKingdom().isAllianceWith(ko.getKingdom())){\r\n                return true;\r\n            }else{\r\n                return false;\r\n            }\r\n        }else{\r\n            return false;\r\n        }\r\n    }\r\n    public static boolean inTerritory(Player P){\r\n        KingdomPlayer kp = GameManagement.getPlayerManager().getSession(P);\r\n        SimpleLocation loc = new SimpleLocation(P.getLocation());\r\n        Land land = GameManagement.getLandManager().getOrLoadLand(loc.toSimpleChunk());\r\n        Kingdom kingdom = GameManagement.getKingdomManager().getOrLoadKingdom(land.getOwner());\r\n       \r\n        if (kp.getKingdom() != null && kingdom != null){\r\n        if (kingdom.equals(kp.getKingdom())){\r\n            return true;\r\n        }else{\r\n            return false;\r\n        }\r\n    }else{\r\n        return false;\r\n    }\r\n    }\r\n     public static boolean canBreakBlock(Player player, Block block){\r\n       \r\n        KingdomPlayer kp = GameManagement.getPlayerManager().getSession(player);\r\n        SimpleLocation loc = new SimpleLocation(block.getLocation());\r\n        Land land = GameManagement.getLandManager().getOrLoadLand(loc.toSimpleChunk());\r\n       \r\n        Kingdom kingdomland = GameManagement.getKingdomManager().getOrLoadKingdom(land.getOwner());\r\n       \r\n        if (land.getOwner() == null) return true;\r\n        if(kp.isAdminMode()) return true;\r\n       \r\n        if(kingdomland.equals(kp.getKingdom())){\r\n            return true;\r\n        }else{\r\n            return false;\r\n        }\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"kicjow"}}