From 501a7aa77ad8676df1fe73409b745e8ad24d47ae Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 14 Aug 2014 21:22:39 -0700 Subject: [PATCH] Add ProtectedRegion.copyFrom(). --- .../protection/regions/ProtectedRegion.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java b/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java index 01744050..d9aba90c 100644 --- a/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java +++ b/src/main/java/com/sk89q/worldguard/protection/regions/ProtectedRegion.java @@ -462,6 +462,24 @@ public void setFlags(Map, Object> flags) { this.flags = new ConcurrentHashMap, Object>(flags); } + /** + * Copy attributes from another region. + * + * @param other the other region + */ + public void copyFrom(ProtectedRegion other) { + checkNotNull(other); + setMembers(other.getMembers()); + setOwners(other.getOwners()); + setFlags(other.getFlags()); + setPriority(other.getPriority()); + try { + setParent(other.getParent()); + } catch (CircularInheritanceException ignore) { + // This should not be thrown + } + } + /** * Get points of the region projected onto the X-Z plane. *