@@ -1864,71 +1864,18 @@ else if (cmd.getName().equalsIgnoreCase("restrictsubclaim") && player != null) {
18641864 return true ;
18651865 }
18661866
1867- // Only the owner of the parent claim may toggle restrictions. Admin claims
1868- // require admin permission.
1869- if (!player .hasPermission ("griefprevention.adminclaims" )) {
1870- GriefPrevention .sendMessage (player , TextMode .Err , Messages .NoAdminClaimsPermission );
1867+ // If player has /ignoreclaims on, continue
1868+ // If admin claim, fail if this user is not an admin
1869+ // If not an admin claim, fail if this user is not the owner
1870+ if (!playerData .ignoreClaims && (claim .isAdminClaim () ? !player .hasPermission ("griefprevention.adminclaims" ) : !player .getUniqueId ().equals (claim .parent .ownerID ))) {
1871+ GriefPrevention .sendMessage (player , TextMode .Err , Messages .OnlyOwnersModifyClaims , claim .getOwnerName ());
18711872 return true ;
18721873 }
18731874
18741875 if (claim .getSubclaimRestrictions ()) {
18751876 claim .setSubclaimRestrictions (false );
18761877 GriefPrevention .sendMessage (player , TextMode .Success , Messages .SubclaimUnrestricted );
18771878 } else {
1878- // When restricting, remove inherited permissions but keep explicit ones
1879- if (claim .parent != null && !claim .getSubclaimRestrictions ()) {
1880- // Get all permissions from parent that would be inherited
1881- ArrayList <String > parentBuilders = new ArrayList <>();
1882- ArrayList <String > parentContainers = new ArrayList <>();
1883- ArrayList <String > parentAccessors = new ArrayList <>();
1884- ArrayList <String > parentManagers = new ArrayList <>();
1885- claim .parent .getPermissions (parentBuilders , parentContainers , parentAccessors , parentManagers );
1886-
1887- // Get current permissions in this claim
1888- ArrayList <String > currentBuilders = new ArrayList <>();
1889- ArrayList <String > currentContainers = new ArrayList <>();
1890- ArrayList <String > currentAccessors = new ArrayList <>();
1891- ArrayList <String > currentManagers = new ArrayList <>();
1892- claim .getPermissions (currentBuilders , currentContainers , currentAccessors , currentManagers );
1893-
1894- // Remove permissions that exist in both parent and child (inherited ones)
1895- for (String manager : parentManagers ) {
1896- if (currentManagers .contains (manager )) {
1897- claim .managers .remove (manager );
1898- }
1899- }
1900-
1901- for (String builder : parentBuilders ) {
1902- if (currentBuilders .contains (builder )) {
1903- // Check if this builder permission matches the parent's builder permission
1904- ClaimPermission childPerm = claim .getPermission (builder .toLowerCase ());
1905- if (childPerm == ClaimPermission .Build ) {
1906- claim .dropPermission (builder );
1907- }
1908- }
1909- }
1910-
1911- for (String container : parentContainers ) {
1912- if (currentContainers .contains (container )) {
1913- // Check if this container permission matches the parent's container permission
1914- ClaimPermission childPerm = claim .getPermission (container .toLowerCase ());
1915- if (childPerm == ClaimPermission .Container ) {
1916- claim .dropPermission (container );
1917- }
1918- }
1919- }
1920-
1921- for (String accessor : parentAccessors ) {
1922- if (currentAccessors .contains (accessor )) {
1923- // Check if this accessor permission matches the parent's accessor permission
1924- ClaimPermission childPerm = claim .getPermission (accessor .toLowerCase ());
1925- if (childPerm == ClaimPermission .Access ) {
1926- claim .dropPermission (accessor );
1927- }
1928- }
1929- }
1930- }
1931-
19321879 claim .setSubclaimRestrictions (true );
19331880 GriefPrevention .sendMessage (player , TextMode .Success , Messages .SubclaimRestricted );
19341881 }
0 commit comments