├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── api └── java │ └── me │ └── ryanhamshire │ └── griefprevention │ ├── GriefPrevention.java │ └── api │ ├── GriefPreventionApi.java │ ├── claim │ ├── Claim.java │ ├── ClaimBlockSystem.java │ ├── ClaimContexts.java │ ├── ClaimFlag.java │ ├── ClaimManager.java │ ├── ClaimResult.java │ ├── ClaimResultType.java │ ├── ClaimType.java │ ├── FlagResult.java │ ├── FlagResultType.java │ └── TrustType.java │ ├── data │ ├── ClaimData.java │ ├── EconomyData.java │ └── PlayerData.java │ ├── economy │ ├── BankTransaction.java │ └── BankTransactionType.java │ └── event │ ├── AttackPlayerEvent.java │ ├── BorderClaimEvent.java │ ├── ChangeClaimEvent.java │ ├── ClaimEvent.java │ ├── CreateClaimEvent.java │ ├── DeleteClaimEvent.java │ ├── FlagClaimEvent.java │ ├── GPContextKeys.java │ ├── GroupTrustClaimEvent.java │ ├── TaxClaimEvent.java │ ├── TransferClaimEvent.java │ ├── TrustClaimEvent.java │ └── UserTrustClaimEvent.java └── main ├── java ├── me │ └── ryanhamshire │ │ └── griefprevention │ │ ├── DataStore.java │ │ ├── DatabaseDataStore.java │ │ ├── FlatFileDataStore.java │ │ ├── GPDebugData.java │ │ ├── GPFlags.java │ │ ├── GPPlayerData.java │ │ ├── GPTimings.java │ │ ├── GriefPreventionPlugin.java │ │ ├── IpBanInfo.java │ │ ├── ShovelMode.java │ │ ├── claim │ │ ├── ClaimContextCalculator.java │ │ ├── ClaimsMode.java │ │ ├── GPClaim.java │ │ ├── GPClaimManager.java │ │ ├── GPClaimResult.java │ │ └── GPFlagResult.java │ │ ├── command │ │ ├── BaseCommand.java │ │ ├── ClaimFlagBase.java │ │ ├── ClaimSubjectType.java │ │ ├── CommandAccessTrust.java │ │ ├── CommandAdjustBonusClaimBlocks.java │ │ ├── CommandClaimAbandon.java │ │ ├── CommandClaimAbandonAll.java │ │ ├── CommandClaimAdmin.java │ │ ├── CommandClaimBank.java │ │ ├── CommandClaimBasic.java │ │ ├── CommandClaimBook.java │ │ ├── CommandClaimBuy.java │ │ ├── CommandClaimBuyBlocks.java │ │ ├── CommandClaimClear.java │ │ ├── CommandClaimCuboid.java │ │ ├── CommandClaimDelete.java │ │ ├── CommandClaimDeleteAll.java │ │ ├── CommandClaimDeleteAllAdmin.java │ │ ├── CommandClaimFarewell.java │ │ ├── CommandClaimFlag.java │ │ ├── CommandClaimFlagDebug.java │ │ ├── CommandClaimFlagGroup.java │ │ ├── CommandClaimFlagPlayer.java │ │ ├── CommandClaimFlagReset.java │ │ ├── CommandClaimGreeting.java │ │ ├── CommandClaimIgnore.java │ │ ├── CommandClaimInfo.java │ │ ├── CommandClaimInherit.java │ │ ├── CommandClaimList.java │ │ ├── CommandClaimName.java │ │ ├── CommandClaimOption.java │ │ ├── CommandClaimOptionGroup.java │ │ ├── CommandClaimOptionPlayer.java │ │ ├── CommandClaimPermissionGroup.java │ │ ├── CommandClaimPermissionPlayer.java │ │ ├── CommandClaimSell.java │ │ ├── CommandClaimSellBlocks.java │ │ ├── CommandClaimSetSpawn.java │ │ ├── CommandClaimSpawn.java │ │ ├── CommandClaimSubdivide.java │ │ ├── CommandClaimTown.java │ │ ├── CommandClaimTransfer.java │ │ ├── CommandClaimWorldEdit.java │ │ ├── CommandContainerTrust.java │ │ ├── CommandDebug.java │ │ ├── CommandGivePet.java │ │ ├── CommandGpReload.java │ │ ├── CommandGpVersion.java │ │ ├── CommandHelper.java │ │ ├── CommandIgnorePlayer.java │ │ ├── CommandIgnoredPlayerList.java │ │ ├── CommandPermissionTrust.java │ │ ├── CommandPlayerInfo.java │ │ ├── CommandRestoreNature.java │ │ ├── CommandRestoreNatureAggressive.java │ │ ├── CommandRestoreNatureFill.java │ │ ├── CommandSeparate.java │ │ ├── CommandSetAccruedClaimBlocks.java │ │ ├── CommandSoftMute.java │ │ ├── CommandTownChat.java │ │ ├── CommandTownTag.java │ │ ├── CommandTrust.java │ │ ├── CommandTrustAll.java │ │ ├── CommandTrustList.java │ │ ├── CommandUnignorePlayer.java │ │ ├── CommandUnlockDrops.java │ │ ├── CommandUnseparate.java │ │ ├── CommandUntrust.java │ │ └── CommandUntrustAll.java │ │ ├── configuration │ │ ├── ClaimDataConfig.java │ │ ├── ClaimStorageData.java │ │ ├── ClaimTemplateConfig.java │ │ ├── ClaimTemplateStorage.java │ │ ├── EconomyDataConfig.java │ │ ├── GriefPreventionConfig.java │ │ ├── IClaimData.java │ │ ├── MessageDataConfig.java │ │ ├── MessageStorage.java │ │ ├── PlayerDataConfig.java │ │ ├── PlayerStorageData.java │ │ ├── TownDataConfig.java │ │ ├── TownStorageData.java │ │ ├── category │ │ │ ├── BanCategory.java │ │ │ ├── BlacklistCategory.java │ │ │ ├── ClaimCategory.java │ │ │ ├── ConfigCategory.java │ │ │ ├── DatabaseCategory.java │ │ │ ├── EconomyCategory.java │ │ │ ├── FlagCategory.java │ │ │ ├── GeneralCategory.java │ │ │ ├── LoggingCategory.java │ │ │ ├── MessageCategory.java │ │ │ ├── MigratorCategory.java │ │ │ ├── ModuleCategory.java │ │ │ ├── PlayerDataCategory.java │ │ │ ├── PvpCategory.java │ │ │ ├── SpamCategory.java │ │ │ ├── ThreadCategory.java │ │ │ └── TownCategory.java │ │ └── type │ │ │ ├── ConfigBase.java │ │ │ └── GlobalConfig.java │ │ ├── economy │ │ └── GPBankTransaction.java │ │ ├── event │ │ ├── GPAttackPlayerEvent.java │ │ ├── GPBorderClaimEvent.java │ │ ├── GPChangeClaimEvent.java │ │ ├── GPClaimEvent.java │ │ ├── GPCreateClaimEvent.java │ │ ├── GPDeleteClaimEvent.java │ │ ├── GPFlagClaimEvent.java │ │ ├── GPGroupTrustClaimEvent.java │ │ ├── GPTaxClaimEvent.java │ │ ├── GPTransferClaimEvent.java │ │ ├── GPTrustClaimEvent.java │ │ ├── GPUserTrustClaimEvent.java │ │ └── package-info.java │ │ ├── listener │ │ ├── BlockEventHandler.java │ │ ├── EntityEventHandler.java │ │ ├── EntityRemovalListener.java │ │ ├── MCClansEventHandler.java │ │ ├── NucleusEventHandler.java │ │ ├── PlayerEventHandler.java │ │ └── WorldEventHandler.java │ │ ├── logging │ │ ├── CustomLogEntryTypes.java │ │ └── CustomLogger.java │ │ ├── migrator │ │ ├── GPPermissionMigrator.java │ │ └── RedProtectMigrator.java │ │ ├── permission │ │ ├── GPBlacklists.java │ │ ├── GPOptionHandler.java │ │ ├── GPOptions.java │ │ ├── GPPermissionHandler.java │ │ └── GPPermissions.java │ │ ├── provider │ │ ├── GPApiProvider.java │ │ ├── MCClansApiProvider.java │ │ ├── NucleusApiProvider.java │ │ ├── WorldEditApiProvider.java │ │ └── worldedit │ │ │ ├── GPActor.java │ │ │ └── cui │ │ │ ├── MultiSelectionColors.java │ │ │ ├── MultiSelectionType.java │ │ │ └── event │ │ │ ├── MultiSelectionClearEvent.java │ │ │ ├── MultiSelectionColorEvent.java │ │ │ ├── MultiSelectionCuboidEvent.java │ │ │ ├── MultiSelectionGridEvent.java │ │ │ └── MultiSelectionPointEvent.java │ │ ├── task │ │ ├── CheckForPortalTrapTask.java │ │ ├── CleanupUnusedClaimsTask.java │ │ ├── DeliverClaimBlocksTask.java │ │ ├── IgnoreLoaderThread.java │ │ ├── PlayerKickBanTask.java │ │ ├── PvPImmunityValidationTask.java │ │ ├── RestoreNatureExecutionTask.java │ │ ├── RestoreNatureProcessingTask.java │ │ ├── SendPlayerMessageTask.java │ │ ├── TaxApplyTask.java │ │ ├── VisualizationApplicationTask.java │ │ ├── VisualizationReversionTask.java │ │ └── WelcomeTask.java │ │ ├── util │ │ ├── BlockPosCache.java │ │ ├── BlockUtils.java │ │ ├── CauseContextHelper.java │ │ ├── ClaimClickData.java │ │ ├── EntityUtils.java │ │ ├── HttpClient.java │ │ ├── NbtDataHelper.java │ │ ├── PaginationUtils.java │ │ ├── PermissionUtils.java │ │ ├── PlayerUtils.java │ │ └── TaskUtils.java │ │ └── visual │ │ ├── Visualization.java │ │ └── VisualizationType.java └── org │ └── bstats │ └── sponge │ ├── Metrics.java │ └── Metrics2.java └── resources ├── META-INF └── griefprevention_at.cfg └── assets └── lang ├── de_DE.conf ├── ru_RU.conf └── zh_CN.conf /.gitattributes: -------------------------------------------------------------------------------- 1 | # Normalize as LF in the repository, OS native locally 2 | * text=auto 3 | 4 | *.bat text eol=crlf 5 | gradlew text eol=lf 6 | *.sh text eol=lf 7 | 8 | *.java text 9 | *.java diff=java 10 | 11 | # Binary files that should not be modified 12 | *.dat binary 13 | *.db binary 14 | *.icns binary 15 | *.ico binary 16 | *.jar binary 17 | *.jks binary 18 | *.jpg binary 19 | *.key binary 20 | *.png binary 21 | *.ttf binary 22 | *.wav binary 23 | JavaApplicationStub binary 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build # 2 | ######### 3 | MANIFEST.MF 4 | dependency-reduced-pom.xml 5 | 6 | # Compiled # 7 | ############ 8 | bin 9 | build 10 | dist 11 | lib 12 | out 13 | run 14 | target 15 | *.com 16 | *.class 17 | *.dll 18 | *.exe 19 | *.o 20 | *.so 21 | 22 | # Databases # 23 | ############# 24 | *.db 25 | *.sql 26 | *.sqlite 27 | 28 | # Packages # 29 | ############ 30 | *.7z 31 | *.dmg 32 | *.gz 33 | *.iso 34 | *.rar 35 | *.tar 36 | *.zip 37 | 38 | # Repository # 39 | ############## 40 | .git 41 | 42 | # Logging # 43 | ########### 44 | /logs 45 | *.log 46 | 47 | # Misc # 48 | ######## 49 | *.bak 50 | 51 | # System # 52 | ########## 53 | .DS_Store 54 | ehthumbs.db 55 | Thumbs.db 56 | 57 | # Project # 58 | ########### 59 | .classpath 60 | .externalToolBuilders 61 | .gradle 62 | .idea 63 | .project 64 | .settings 65 | .checkstyle 66 | .factorypath 67 | run 68 | ./eclipse 69 | nbproject 70 | atlassian-ide-plugin.xml 71 | build.xml 72 | nb-configuration.xml 73 | *.iml 74 | *.ipr 75 | *.iws 76 | /.apt_generated/ 77 | *.launch 78 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Ryan Hamshire 4 | Copyright (c) contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://i.imgur.com/LJHffk6.png) *Automatically prevent all types of grief!* 2 | 3 | ##### *GriefPrevention* is a Minecraft plugin designed to protect servers from grief. 4 | 5 | 6 | [**Download**](https://ore.spongepowered.org/blood/GriefPrevention/versions) 7 | [**Source**](https://github.com/MinecraftPortCentral/GriefPrevention) 8 | [**Wiki**](https://github.com/MinecraftPortCentral/GriefPrevention/wiki) 9 | [**Original Plugin**](http://dev.bukkit.org/bukkit-plugins/grief-prevention/) 10 | [**Original Video**](https://www.youtube.com/watch?v=RWekSeMi1OE&index=1&list=PL6diNfcl9_VyPiXE8AKQeB6pMshusqhzR) 11 | [**Discord**](https://discord.gg/jy4FQDz) 12 | [**Support Me**](https://www.patreon.com/bloodmc) 13 | 14 | 15 | Note: If using SpongeForge, it will also require [Forge]. 16 | For more information on how to install, see [Getting Started](https://github.com/MinecraftPortCentral/GriefPrevention/wiki/Getting-Started) 17 | 18 | ## Prerequisites 19 | * [Java 8], [LuckPerms], [SpongeForge] or [SpongeVanilla] 20 | 21 | ## Cloning 22 | 23 | `git clone --recursive https://github.com/MinecraftPortCentral/GriefPrevention.git` 24 | 25 | ## Building 26 | In order to build GriefPrevention you simply need to run the `gradlew` command. On Windows systems you should run `gradlew` instead of `./gradlew` to invoke the Gradle wrapper. You can find the compiled JAR files in `./build/libs` but in most cases you'll only need `griefprevention-x.x.x-x.x.x.x.jar`. 27 | 28 | ## Updating your Clone 29 | The following steps will update your clone with the official repo. 30 | 31 | 1. `git pull` 32 | 33 | ## Contributing 34 | If you want to contribute to the project, you can one of two things : 35 | * Create a PR on [Github](https://github.com/MinecraftPortCentral/GriefPrevention). 36 | * Contact me on [Discord] to discuss your ideas. 37 | 38 | [Discord]: https://discord.gg/jy4FQDz 39 | [Forge]: http://files.minecraftforge.net 40 | [Java 8]: http://java.oracle.com 41 | [LuckPerms]: https://github.com/lucko/LuckPerms 42 | [Source]: https://github.com/MinecraftPortCentral/GriefPrevention 43 | [SpongeForge]: https://www.spongepowered.org/downloads/spongeforge 44 | [SpongeVanilla]: https://www.spongepowered.org/downloads/spongevanilla 45 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | name=GriefPrevention 2 | group=me.ryanhamshire 3 | url=https://github.com/MinecraftPortCentral/GriefPrevention 4 | organization=MinecraftPortCentral 5 | version=4.3.0 6 | apiVersion=7.2.0-SNAPSHOT 7 | commonVersion=1.12.2-7.1.7-SNAPSHOT 8 | 9 | minecraftVersion=1.12.2 10 | mcpMappings=snapshot_20171007 11 | 12 | org.gradle.jvmargs=-Xmx3G -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MinecraftPortCentral/GriefPrevention/ff7d1aac63b6a2267cb31359f04429a851a08d72/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Apr 09 18:35:47 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = name 2 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/GriefPrevention.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention; 26 | 27 | import me.ryanhamshire.griefprevention.api.GriefPreventionApi; 28 | 29 | public final class GriefPrevention { 30 | 31 | private static final GriefPreventionApi api = null; 32 | 33 | /** 34 | * Gets the API instance of {@link GriefPreventionApi} 35 | * 36 | * @return The API instance, if available 37 | * @throws IllegalStateException if the API is not loaded 38 | */ 39 | public static GriefPreventionApi getApi() { 40 | if (api == null) { 41 | throw new IllegalStateException("The GriefPrevention API is not loaded."); 42 | } 43 | return api; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/claim/ClaimBlockSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.claim; 26 | 27 | public enum ClaimBlockSystem { 28 | 29 | /** 30 | * Uses {@link Claim#getArea()} to determine the cost of a claim. 31 | * Note: This only accounts for x and z. 32 | */ 33 | AREA, 34 | /** 35 | * Uses {@link Claim#getVolume()} to determine the cost of a claim. 36 | * Note: This accounts for x, y, and z. 37 | */ 38 | VOLUME 39 | } 40 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/claim/ClaimContexts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.claim; 26 | 27 | import org.spongepowered.api.service.context.Context; 28 | 29 | import java.util.Arrays; 30 | import java.util.List; 31 | 32 | /** 33 | * Contains a list of all possible default and override contexts used. 34 | */ 35 | public class ClaimContexts { 36 | 37 | public static final Context ADMIN_DEFAULT_CONTEXT = new Context("gp_claim_defaults", "ADMIN"); 38 | public static final Context ADMIN_OVERRIDE_CONTEXT = new Context("gp_claim_overrides", "ADMIN"); 39 | public static final Context BASIC_DEFAULT_CONTEXT = new Context("gp_claim_defaults", "BASIC"); 40 | public static final Context BASIC_OVERRIDE_CONTEXT = new Context("gp_claim_overrides", "BASIC"); 41 | public static final Context TOWN_DEFAULT_CONTEXT = new Context("gp_claim_defaults", "TOWN"); 42 | public static final Context TOWN_OVERRIDE_CONTEXT = new Context("gp_claim_overrides", "TOWN"); 43 | public static final Context WILDERNESS_OVERRIDE_CONTEXT = new Context("gp_claim_overrides", "WILDERNESS"); 44 | public static final Context WILDERNESS_DEFAULT_CONTEXT = new Context("gp_claim_defaults", "WILDERNESS"); 45 | public static final List CONTEXT_LIST = Arrays.asList( 46 | ADMIN_DEFAULT_CONTEXT, ADMIN_OVERRIDE_CONTEXT, 47 | BASIC_DEFAULT_CONTEXT, BASIC_OVERRIDE_CONTEXT, 48 | TOWN_DEFAULT_CONTEXT, TOWN_OVERRIDE_CONTEXT, 49 | WILDERNESS_OVERRIDE_CONTEXT, WILDERNESS_DEFAULT_CONTEXT); 50 | } 51 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/claim/ClaimType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.claim; 26 | 27 | import org.spongepowered.api.world.World; 28 | 29 | /** 30 | * Represents a type of claim. 31 | */ 32 | public enum ClaimType { 33 | 34 | /** 35 | * Represents a claim type that is managed by admins. 36 | */ 37 | ADMIN, 38 | /** 39 | * Represents a claim type that is managed by one or more players. 40 | */ 41 | BASIC, 42 | /** 43 | * Represents a sub-claim type that can be one or more blocks. 44 | * 45 | * Note: This type is not supported in {@link #WILDERNESS} 46 | */ 47 | SUBDIVISION, 48 | /** 49 | * Represents a claim type that supports multiple levels of {@link #BASIC} 50 | * claims. 51 | */ 52 | TOWN, 53 | /** 54 | * Represents all the block space in a single {@link World} not 55 | * used by any other claim type. There will only be one wilderness 56 | * claim per world. 57 | */ 58 | WILDERNESS 59 | } 60 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/claim/FlagResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.claim; 26 | 27 | import java.util.Optional; 28 | 29 | import org.spongepowered.api.text.Text; 30 | 31 | public interface FlagResult { 32 | 33 | /** 34 | * Gets the {@link FlagResultType} of flag action. 35 | * 36 | * @return The result type 37 | */ 38 | FlagResultType getResultType(); 39 | 40 | /** 41 | * Gets the result message. 42 | * 43 | * Note: normally this is set during event cancellations. 44 | * 45 | * @return The result message, if available 46 | */ 47 | Optional getMessage(); 48 | 49 | /** 50 | * A simple helper method to determine if the {@link ClaimResult} 51 | * was a success. 52 | * 53 | * @return Whether the claim result was a success 54 | */ 55 | default boolean successful() { 56 | return this.getResultType() == FlagResultType.SUCCESS; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/claim/FlagResultType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.claim; 26 | 27 | public enum FlagResultType { 28 | 29 | SOURCE_NOT_VALID, 30 | TARGET_NOT_VALID, 31 | SOURCE_NOT_VALID_FOR_FLAG, 32 | TARGET_NOT_VALID_FOR_FLAG, 33 | CONTEXT_NOT_VALID, 34 | EVENT_CANCELLED, 35 | NO_PERMISSION, 36 | SUCCESS 37 | } 38 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/claim/TrustType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.claim; 26 | 27 | /** 28 | * Represents a type of claim trust. 29 | */ 30 | public enum TrustType { 31 | 32 | /** 33 | * Represents no specific trust. 34 | * Note: This is usually passed when a plugin wants to remove all trusts. 35 | */ 36 | NONE, 37 | /** 38 | * Allows access to interact with all blocks except inventory. 39 | */ 40 | ACCESSOR, 41 | /** 42 | * Allows access to interact with all blocks including inventory. 43 | */ 44 | CONTAINER, 45 | /** 46 | * Inherits trust from both {@link #ACCESSOR} and {@link #CONTAINER} 47 | * as well as adds ability to place and break blocks. 48 | */ 49 | BUILDER, 50 | /** 51 | * Allows full access to claim including management. 52 | * Note: Managers can only transfer and abandon children claims. 53 | */ 54 | MANAGER 55 | } 56 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/economy/BankTransaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.economy; 26 | 27 | import me.ryanhamshire.griefprevention.GriefPrevention; 28 | 29 | import java.time.Instant; 30 | import java.util.Optional; 31 | import java.util.UUID; 32 | 33 | /** 34 | * Contains information of a bank transaction in a claim. 35 | */ 36 | public interface BankTransaction { 37 | 38 | /** 39 | * Gets the {@link BankTransactionType}. 40 | * 41 | * @return The type 42 | */ 43 | BankTransactionType getType(); 44 | 45 | /** 46 | * Gets the source of this transaction. 47 | * 48 | * @return The source, if available 49 | */ 50 | Optional getSource(); 51 | 52 | /** 53 | * Gets the timestamp of this transaction. 54 | * 55 | * @return The timestamp 56 | */ 57 | Instant getTimestamp(); 58 | 59 | /** 60 | * Gets the amount of the this transaction. 61 | * 62 | * @return The amount 63 | */ 64 | Double getAmount(); 65 | 66 | /** 67 | * Gets a new claim builder instance for {@link Builder}. 68 | * 69 | * @return A new claim builder instance 70 | */ 71 | public static BankTransaction.Builder builder() { 72 | return GriefPrevention.getApi().createBankTransactionBuilder(); 73 | } 74 | 75 | public interface Builder { 76 | 77 | Builder type(BankTransactionType type); 78 | 79 | Builder source(UUID source); 80 | 81 | Builder amount(double amount); 82 | 83 | Builder reset(); 84 | 85 | BankTransaction build(); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/economy/BankTransactionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.economy; 26 | 27 | /** 28 | * Contains all possible {@link BankTransaction} types. 29 | */ 30 | public enum BankTransactionType { 31 | 32 | /** 33 | * Bank deposit was successful. 34 | */ 35 | DEPOSIT_SUCCESS, 36 | /** 37 | * Bank deposit failed. 38 | */ 39 | DEPOSIT_FAIL, 40 | /** 41 | * Bank withdrawal was successful. 42 | */ 43 | WITHDRAW_SUCCESS, 44 | /** 45 | * Bank withdrawal failed. 46 | */ 47 | WITHDRAW_FAIL, 48 | /** 49 | * Tax payment was successful. 50 | */ 51 | TAX_SUCCESS, 52 | /** 53 | * Tax payment failed. 54 | */ 55 | TAX_FAIL 56 | } 57 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/AttackPlayerEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import org.spongepowered.api.event.entity.living.humanoid.player.TargetPlayerEvent; 28 | 29 | public interface AttackPlayerEvent extends TargetPlayerEvent, ClaimEvent { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/ChangeClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import me.ryanhamshire.griefprevention.api.claim.ClaimType; 29 | import org.spongepowered.api.world.Location; 30 | import org.spongepowered.api.world.World; 31 | 32 | /** 33 | * An event that is fired before a {@link Claim} is changed. 34 | * 35 | * Note: Canceling this event will prevent claim change. 36 | */ 37 | public interface ChangeClaimEvent extends ClaimEvent { 38 | 39 | interface Type extends ChangeClaimEvent { 40 | /** 41 | * Gets the original {@link ClaimType}. 42 | * 43 | * @return The original claim type 44 | */ 45 | ClaimType getOriginalType(); 46 | 47 | /** 48 | * Gets the new {@link ClaimType}. 49 | * 50 | * @return The new claim type 51 | */ 52 | ClaimType getType(); 53 | } 54 | 55 | interface Resize extends ChangeClaimEvent { 56 | /** 57 | * The start corner location for resize. 58 | * 59 | * @return The start location 60 | */ 61 | Location getStartCorner(); 62 | 63 | /** 64 | * The end corner location to resize to. 65 | * 66 | * @return The end corner location 67 | */ 68 | Location getEndCorner(); 69 | 70 | /** 71 | * The attempted resized claim. 72 | * 73 | * Note: The original claim is only resized if event isn't cancelled. 74 | * This claim just represents a temporary one before final checks. 75 | * 76 | * @return The resized claim 77 | */ 78 | Claim getResizedClaim(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/ClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import org.spongepowered.api.command.CommandSource; 29 | import org.spongepowered.api.event.Cancellable; 30 | import org.spongepowered.api.event.Event; 31 | import org.spongepowered.api.text.Text; 32 | 33 | import java.util.List; 34 | import java.util.Optional; 35 | 36 | public interface ClaimEvent extends Cancellable, Event { 37 | 38 | /** 39 | * Gets the immutable list of claims. 40 | * 41 | * @return The immutable list of claims 42 | */ 43 | List getClaims(); 44 | 45 | /** 46 | * Gets the first claim. 47 | * 48 | * Note: This is a helper method for events that will usually always 49 | * contain one claim instead of calling {@link #getClaims}. 50 | * 51 | * @return The first claim 52 | */ 53 | default Claim getClaim() { 54 | return this.getClaims().get(0); 55 | } 56 | 57 | /** 58 | * Sets the claim message to be presented to {@link CommandSource} 59 | * if applicable. 60 | * 61 | * @param message The message 62 | */ 63 | void setMessage(Text message); 64 | 65 | /** 66 | * Gets the claim message. 67 | * 68 | * Note: This is only available if event was cancelled. 69 | * 70 | * @return The claim message, if available 71 | */ 72 | Optional getMessage(); 73 | } 74 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/CreateClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | /** 28 | * An event that is fired before a claim is created. 29 | * 30 | * Note: Canceling this event will prevent claim creation. 31 | */ 32 | public interface CreateClaimEvent extends ClaimEvent { 33 | 34 | /** 35 | * Fired before the claim is created. 36 | */ 37 | interface Pre extends CreateClaimEvent {}; 38 | 39 | /** 40 | * Fired after the claim is created. 41 | */ 42 | interface Post extends CreateClaimEvent {}; 43 | } 44 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/DeleteClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | public interface DeleteClaimEvent extends ClaimEvent { 28 | 29 | /** 30 | * Fired when a claim is abandoned. 31 | */ 32 | interface Abandon extends DeleteClaimEvent {}; 33 | } 34 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/FlagClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.ClaimFlag; 28 | import org.spongepowered.api.service.context.Context; 29 | import org.spongepowered.api.service.permission.Subject; 30 | import org.spongepowered.api.util.Tristate; 31 | 32 | import java.util.Optional; 33 | 34 | public interface FlagClaimEvent extends ClaimEvent { 35 | 36 | Subject getSubject(); 37 | 38 | interface Clear extends FlagClaimEvent { 39 | java.util.Set getContexts(); 40 | } 41 | 42 | interface Set extends FlagClaimEvent { 43 | 44 | ClaimFlag getFlag(); 45 | 46 | Optional getSource(); 47 | 48 | String getTarget(); 49 | 50 | Tristate getValue(); 51 | 52 | Context getPermissionContext(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/GPContextKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import org.spongepowered.api.event.cause.EventContextKey; 28 | import org.spongepowered.api.plugin.PluginContainer; 29 | 30 | public final class GPContextKeys { 31 | 32 | public static final EventContextKey CHEST_CLAIM_EXPIRED = EventContextKey.builder(PluginContainer.class) 33 | .name("ChestClaimExpired") 34 | .id("griefprevention:chest_claim_expired") 35 | .build(); 36 | 37 | public static final EventContextKey PLAYER_CLAIM_EXPIRED = EventContextKey.builder(PluginContainer.class) 38 | .name("PlayerClaimExpired") 39 | .id("griefprevention:player_claim_expired") 40 | .build(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/GroupTrustClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import java.util.List; 28 | 29 | public interface GroupTrustClaimEvent extends TrustClaimEvent { 30 | 31 | /** 32 | * Gets the list of groups requesting trust. 33 | * 34 | * @return The list of groups requesting trust 35 | */ 36 | List getGroups(); 37 | 38 | /** 39 | * Fired when a group is added to claim trust. 40 | */ 41 | interface Add extends GroupTrustClaimEvent, TrustClaimEvent.Add {}; 42 | 43 | /** 44 | * Fired when a group is removed from claim trust. 45 | */ 46 | interface Remove extends GroupTrustClaimEvent, TrustClaimEvent.Remove {}; 47 | } 48 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/TaxClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | /** 28 | * An event that is fired before a claim is taxed. 29 | * 30 | * Note: Canceling this event will prevent claim being taxed. 31 | */ 32 | public interface TaxClaimEvent extends ClaimEvent { 33 | 34 | /** 35 | * Gets the original tax rate for claim. 36 | * 37 | * @return The original tax rate 38 | */ 39 | double getOriginalTaxRate(); 40 | 41 | /** 42 | * Gets the original tax amount for claim. 43 | * 44 | * @return The original tax amount 45 | */ 46 | double getOriginalTaxAmount(); 47 | 48 | /** 49 | * Gets the current tax rate to be applied to claim. 50 | * 51 | * @return The current tax rate 52 | */ 53 | double getTaxRate(); 54 | 55 | /** 56 | * Gets the current total tax amount to be applied to claim. 57 | * 58 | * Note: To adjust the tax amount, use {{@link #setTaxRate(double)} 59 | * 60 | * @return The current total tax amount 61 | */ 62 | double getTaxAmount(); 63 | 64 | /** 65 | * Sets a new tax rate for claim. 66 | * 67 | * @param newTaxRate The new tax rate. 68 | */ 69 | void setTaxRate(double newTaxRate); 70 | } 71 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/TransferClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import java.util.UUID; 28 | 29 | public interface TransferClaimEvent extends ClaimEvent { 30 | 31 | UUID getOriginalOwner(); 32 | 33 | UUID getNewOwner(); 34 | 35 | void setNewOwner(UUID uuid); 36 | } 37 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/TrustClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 28 | 29 | public interface TrustClaimEvent extends ClaimEvent { 30 | 31 | /** 32 | * The {@link TrustType} to grant user. 33 | * 34 | * @return The trust type 35 | */ 36 | TrustType getTrustType(); 37 | 38 | /** 39 | * Fired when a user is added to claim trust. 40 | */ 41 | interface Add extends TrustClaimEvent {}; 42 | 43 | /** 44 | * Fired when a user is removed from claim trust. 45 | */ 46 | interface Remove extends TrustClaimEvent {}; 47 | } 48 | -------------------------------------------------------------------------------- /src/api/java/me/ryanhamshire/griefprevention/api/event/UserTrustClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.api.event; 26 | 27 | import java.util.List; 28 | import java.util.UUID; 29 | 30 | public interface UserTrustClaimEvent extends TrustClaimEvent { 31 | 32 | /** 33 | * Gets the list of {@link UUID}'s requesting trust. 34 | * 35 | * @return The list of uuid's requesting trust 36 | */ 37 | List getUsers(); 38 | 39 | /** 40 | * Fired when a user is added to claim trust. 41 | */ 42 | interface Add extends UserTrustClaimEvent {}; 43 | 44 | /** 45 | * Fired when a user is removed from claim trust. 46 | */ 47 | interface Remove extends UserTrustClaimEvent {}; 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/IpBanInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention; 26 | 27 | import java.net.InetAddress; 28 | 29 | public class IpBanInfo { 30 | 31 | public InetAddress address; 32 | public long expirationTimestamp; 33 | public String bannedAccountName; 34 | 35 | public IpBanInfo(InetAddress address, long expirationTimestamp, String bannedAccountName) { 36 | this.address = address; 37 | this.expirationTimestamp = expirationTimestamp; 38 | this.bannedAccountName = bannedAccountName; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/ShovelMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention; 26 | 27 | //enumeration for golden shovel modes 28 | public enum ShovelMode { 29 | Basic, 30 | Admin, 31 | Subdivide, 32 | RestoreNature, 33 | RestoreNatureAggressive, 34 | RestoreNatureFill, 35 | Town 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/claim/ClaimsMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.claim; 26 | 27 | public enum ClaimsMode { 28 | Disabled, 29 | Survival, 30 | Creative 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/claim/GPFlagResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.claim; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.FlagResult; 28 | import me.ryanhamshire.griefprevention.api.claim.FlagResultType; 29 | import org.spongepowered.api.text.Text; 30 | 31 | import java.util.Optional; 32 | 33 | public class GPFlagResult implements FlagResult { 34 | 35 | private final FlagResultType resultType; 36 | private final Text eventMessage; 37 | 38 | public GPFlagResult(FlagResultType type) { 39 | this(type, null); 40 | } 41 | 42 | public GPFlagResult(FlagResultType type, Text message) { 43 | this.resultType = type; 44 | this.eventMessage = message; 45 | } 46 | 47 | @Override 48 | public FlagResultType getResultType() { 49 | return this.resultType; 50 | } 51 | 52 | @Override 53 | public Optional getMessage() { 54 | return Optional.ofNullable(this.eventMessage); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/BaseCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.command; 26 | 27 | import org.spongepowered.api.command.spec.CommandExecutor; 28 | 29 | public abstract class BaseCommand implements CommandExecutor { 30 | 31 | protected String basePerm; 32 | 33 | public BaseCommand(String basePerm) { 34 | this.basePerm = basePerm; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/ClaimSubjectType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.command; 26 | 27 | public enum ClaimSubjectType { 28 | 29 | GLOBAL("Global"), 30 | GROUP("Group"), 31 | PLAYER("Player"); 32 | 33 | private String friendlyName; 34 | 35 | private ClaimSubjectType(String name) { 36 | this.friendlyName = name; 37 | } 38 | 39 | public String getFriendlyName() { 40 | return this.friendlyName; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandAccessTrust.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 29 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 30 | import org.spongepowered.api.command.CommandException; 31 | import org.spongepowered.api.command.CommandResult; 32 | import org.spongepowered.api.command.CommandSource; 33 | import org.spongepowered.api.command.args.CommandContext; 34 | import org.spongepowered.api.command.spec.CommandExecutor; 35 | import org.spongepowered.api.entity.living.player.User; 36 | 37 | public class CommandAccessTrust implements CommandExecutor { 38 | 39 | @Override 40 | public CommandResult execute(CommandSource src, CommandContext ctx) { 41 | User user = ctx.getOne("user").orElse(null); 42 | String group = null; 43 | if (user == null) { 44 | group = ctx.getOne("group").orElse(null); 45 | if (group.equalsIgnoreCase("public") || group.equalsIgnoreCase("all")) { 46 | user = GriefPreventionPlugin.PUBLIC_USER; 47 | group = null; 48 | } 49 | } 50 | try { 51 | if (user != null) { 52 | CommandHelper.handleUserTrustCommand(GriefPreventionPlugin.checkPlayer(src), TrustType.ACCESSOR, user); 53 | } else { 54 | CommandHelper.handleGroupTrustCommand(GriefPreventionPlugin.checkPlayer(src), TrustType.ACCESSOR, group); 55 | } 56 | } catch (CommandException e) { 57 | src.sendMessage(e.getText()); 58 | } 59 | return CommandResult.success(); 60 | } 61 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandClaimAdmin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import me.ryanhamshire.griefprevention.ShovelMode; 31 | import org.spongepowered.api.command.CommandException; 32 | import org.spongepowered.api.command.CommandResult; 33 | import org.spongepowered.api.command.CommandSource; 34 | import org.spongepowered.api.command.args.CommandContext; 35 | import org.spongepowered.api.command.spec.CommandExecutor; 36 | import org.spongepowered.api.entity.living.player.Player; 37 | 38 | public class CommandClaimAdmin implements CommandExecutor { 39 | 40 | @Override 41 | public CommandResult execute(CommandSource src, CommandContext ctx) { 42 | Player player; 43 | try { 44 | player = GriefPreventionPlugin.checkPlayer(src); 45 | } catch (CommandException e) { 46 | src.sendMessage(e.getText()); 47 | return CommandResult.success(); 48 | } 49 | 50 | final GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 51 | playerData.shovelMode = ShovelMode.Admin; 52 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.claimModeAdmin.toText()); 53 | return CommandResult.success(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandClaimBasic.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import me.ryanhamshire.griefprevention.ShovelMode; 31 | import org.spongepowered.api.command.CommandException; 32 | import org.spongepowered.api.command.CommandResult; 33 | import org.spongepowered.api.command.CommandSource; 34 | import org.spongepowered.api.command.args.CommandContext; 35 | import org.spongepowered.api.command.spec.CommandExecutor; 36 | import org.spongepowered.api.entity.living.player.Player; 37 | 38 | public class CommandClaimBasic implements CommandExecutor { 39 | 40 | @Override 41 | public CommandResult execute(CommandSource src, CommandContext ctx) { 42 | Player player; 43 | try { 44 | player = GriefPreventionPlugin.checkPlayer(src); 45 | } catch (CommandException e) { 46 | src.sendMessage(e.getText()); 47 | return CommandResult.success(); 48 | } 49 | 50 | final GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 51 | playerData.shovelMode = ShovelMode.Basic; 52 | playerData.claimSubdividing = null; 53 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.claimModeBasic.toText()); 54 | 55 | return CommandResult.success(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandClaimBook.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.task.WelcomeTask; 29 | import org.spongepowered.api.command.CommandResult; 30 | import org.spongepowered.api.command.CommandSource; 31 | import org.spongepowered.api.command.args.CommandContext; 32 | import org.spongepowered.api.command.spec.CommandExecutor; 33 | import org.spongepowered.api.entity.living.player.Player; 34 | 35 | public class CommandClaimBook implements CommandExecutor { 36 | 37 | @Override 38 | public CommandResult execute(CommandSource src, CommandContext ctx) { 39 | for (Player otherPlayer : ctx.getAll("player")) { 40 | WelcomeTask task = new WelcomeTask(otherPlayer); 41 | task.run(); 42 | } 43 | 44 | return CommandResult.success(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandClaimCuboid.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import org.spongepowered.api.command.CommandException; 31 | import org.spongepowered.api.command.CommandResult; 32 | import org.spongepowered.api.command.CommandSource; 33 | import org.spongepowered.api.command.args.CommandContext; 34 | import org.spongepowered.api.command.spec.CommandExecutor; 35 | import org.spongepowered.api.entity.living.player.Player; 36 | 37 | public class CommandClaimCuboid implements CommandExecutor { 38 | 39 | @Override 40 | public CommandResult execute(CommandSource src, CommandContext ctx) { 41 | Player player; 42 | try { 43 | player = GriefPreventionPlugin.checkPlayer(src); 44 | } catch (CommandException e) { 45 | src.sendMessage(e.getText()); 46 | return CommandResult.success(); 47 | } 48 | 49 | GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 50 | if (playerData.optionClaimCreateMode == 0) { 51 | playerData.setClaimCreateMode(1); 52 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.claimCuboidEnabled.toText()); 53 | } else { 54 | playerData.setClaimCreateMode(0); 55 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.claimCuboidDisabled.toText()); 56 | } 57 | 58 | return CommandResult.success(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandClaimSubdivide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import me.ryanhamshire.griefprevention.ShovelMode; 31 | import org.spongepowered.api.command.CommandException; 32 | import org.spongepowered.api.command.CommandResult; 33 | import org.spongepowered.api.command.CommandSource; 34 | import org.spongepowered.api.command.args.CommandContext; 35 | import org.spongepowered.api.command.spec.CommandExecutor; 36 | import org.spongepowered.api.entity.living.player.Player; 37 | 38 | public class CommandClaimSubdivide implements CommandExecutor { 39 | 40 | @Override 41 | public CommandResult execute(CommandSource src, CommandContext ctx) { 42 | Player player; 43 | try { 44 | player = GriefPreventionPlugin.checkPlayer(src); 45 | } catch (CommandException e) { 46 | src.sendMessage(e.getText()); 47 | return CommandResult.success(); 48 | } 49 | 50 | final GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 51 | playerData.shovelMode = ShovelMode.Subdivide; 52 | playerData.claimSubdividing = null; 53 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.claimModeSubdivision.toText()); 54 | 55 | return CommandResult.success(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandClaimTown.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import me.ryanhamshire.griefprevention.ShovelMode; 31 | import org.spongepowered.api.command.CommandException; 32 | import org.spongepowered.api.command.CommandResult; 33 | import org.spongepowered.api.command.CommandSource; 34 | import org.spongepowered.api.command.args.CommandContext; 35 | import org.spongepowered.api.command.spec.CommandExecutor; 36 | import org.spongepowered.api.entity.living.player.Player; 37 | 38 | public class CommandClaimTown implements CommandExecutor { 39 | 40 | @Override 41 | public CommandResult execute(CommandSource src, CommandContext ctx) { 42 | Player player; 43 | try { 44 | player = GriefPreventionPlugin.checkPlayer(src); 45 | } catch (CommandException e) { 46 | src.sendMessage(e.getText()); 47 | return CommandResult.success(); 48 | } 49 | 50 | final GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 51 | playerData.shovelMode = ShovelMode.Town; 52 | playerData.claimSubdividing = null; 53 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.claimModeTown.toText()); 54 | 55 | return CommandResult.success(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandContainerTrust.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 29 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 30 | import org.spongepowered.api.command.CommandException; 31 | import org.spongepowered.api.command.CommandResult; 32 | import org.spongepowered.api.command.CommandSource; 33 | import org.spongepowered.api.command.args.CommandContext; 34 | import org.spongepowered.api.command.spec.CommandExecutor; 35 | import org.spongepowered.api.entity.living.player.User; 36 | 37 | public class CommandContainerTrust implements CommandExecutor { 38 | 39 | @Override 40 | public CommandResult execute(CommandSource src, CommandContext ctx) { 41 | User user = ctx.getOne("user").orElse(null); 42 | String group = null; 43 | if (user == null) { 44 | group = ctx.getOne("group").orElse(null); 45 | if (group.equalsIgnoreCase("public") || group.equalsIgnoreCase("all")) { 46 | user = GriefPreventionPlugin.PUBLIC_USER; 47 | group = null; 48 | } 49 | } 50 | try { 51 | if (user != null) { 52 | CommandHelper.handleUserTrustCommand(GriefPreventionPlugin.checkPlayer(src), TrustType.CONTAINER, user); 53 | } else { 54 | CommandHelper.handleGroupTrustCommand(GriefPreventionPlugin.checkPlayer(src), TrustType.CONTAINER, group); 55 | } 56 | } catch (CommandException e) { 57 | src.sendMessage(e.getText()); 58 | } 59 | return CommandResult.success(); 60 | } 61 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandGpReload.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.command; 26 | 27 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 28 | import org.spongepowered.api.command.CommandResult; 29 | import org.spongepowered.api.command.CommandSource; 30 | import org.spongepowered.api.command.args.CommandContext; 31 | import org.spongepowered.api.command.spec.CommandExecutor; 32 | 33 | public class CommandGpReload implements CommandExecutor { 34 | 35 | @Override 36 | public CommandResult execute(CommandSource src, CommandContext ctx) { 37 | GriefPreventionPlugin.instance.loadConfig(); 38 | GriefPreventionPlugin.sendMessage(src, GriefPreventionPlugin.instance.messageData.pluginReload.toText()); 39 | return CommandResult.success(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandPermissionTrust.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 29 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 30 | import org.spongepowered.api.command.CommandException; 31 | import org.spongepowered.api.command.CommandResult; 32 | import org.spongepowered.api.command.CommandSource; 33 | import org.spongepowered.api.command.args.CommandContext; 34 | import org.spongepowered.api.command.spec.CommandExecutor; 35 | import org.spongepowered.api.entity.living.player.User; 36 | 37 | public class CommandPermissionTrust implements CommandExecutor { 38 | 39 | @Override 40 | public CommandResult execute(CommandSource src, CommandContext ctx) { 41 | User user = ctx.getOne("user").orElse(null); 42 | String group = null; 43 | if (user == null) { 44 | group = ctx.getOne("group").orElse(null); 45 | if (group.equalsIgnoreCase("public") || group.equalsIgnoreCase("all")) { 46 | user = GriefPreventionPlugin.PUBLIC_USER; 47 | group = null; 48 | } 49 | } 50 | try { 51 | if (user != null) { 52 | CommandHelper.handleUserTrustCommand(GriefPreventionPlugin.checkPlayer(src), TrustType.MANAGER, user); 53 | } else { 54 | CommandHelper.handleGroupTrustCommand(GriefPreventionPlugin.checkPlayer(src), TrustType.MANAGER, group); 55 | } 56 | } catch (CommandException e) { 57 | src.sendMessage(e.getText()); 58 | } 59 | return CommandResult.success(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandRestoreNature.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import me.ryanhamshire.griefprevention.ShovelMode; 31 | import org.spongepowered.api.command.CommandException; 32 | import org.spongepowered.api.command.CommandResult; 33 | import org.spongepowered.api.command.CommandSource; 34 | import org.spongepowered.api.command.args.CommandContext; 35 | import org.spongepowered.api.command.spec.CommandExecutor; 36 | import org.spongepowered.api.entity.living.player.Player; 37 | 38 | public class CommandRestoreNature implements CommandExecutor { 39 | 40 | @Override 41 | public CommandResult execute(CommandSource src, CommandContext ctx) { 42 | Player player; 43 | try { 44 | player = GriefPreventionPlugin.checkPlayer(src); 45 | } catch (CommandException e) { 46 | src.sendMessage(e.getText()); 47 | return CommandResult.success(); 48 | } 49 | 50 | final GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 51 | playerData.shovelMode = ShovelMode.RestoreNature; 52 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.restoreNatureActivate.toText()); 53 | return CommandResult.success(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandRestoreNatureAggressive.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import me.ryanhamshire.griefprevention.ShovelMode; 31 | import org.spongepowered.api.command.CommandException; 32 | import org.spongepowered.api.command.CommandResult; 33 | import org.spongepowered.api.command.CommandSource; 34 | import org.spongepowered.api.command.args.CommandContext; 35 | import org.spongepowered.api.command.spec.CommandExecutor; 36 | import org.spongepowered.api.entity.living.player.Player; 37 | 38 | public class CommandRestoreNatureAggressive implements CommandExecutor { 39 | 40 | @Override 41 | public CommandResult execute(CommandSource src, CommandContext ctx) { 42 | Player player; 43 | try { 44 | player = GriefPreventionPlugin.checkPlayer(src); 45 | } catch (CommandException e) { 46 | src.sendMessage(e.getText()); 47 | return CommandResult.success(); 48 | } 49 | 50 | final GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 51 | playerData.shovelMode = ShovelMode.RestoreNatureAggressive; 52 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.restoreNatureAggressiveActivate.toText()); 53 | return CommandResult.success(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandSeparate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin.IgnoreMode; 30 | import org.spongepowered.api.command.CommandException; 31 | import org.spongepowered.api.command.CommandResult; 32 | import org.spongepowered.api.command.CommandSource; 33 | import org.spongepowered.api.command.args.CommandContext; 34 | import org.spongepowered.api.command.spec.CommandExecutor; 35 | import org.spongepowered.api.entity.living.player.Player; 36 | import org.spongepowered.api.entity.living.player.User; 37 | 38 | public class CommandSeparate implements CommandExecutor { 39 | 40 | @Override 41 | public CommandResult execute(CommandSource src, CommandContext args) { 42 | Player player; 43 | try { 44 | player = GriefPreventionPlugin.checkPlayer(src); 45 | } catch (CommandException e) { 46 | src.sendMessage(e.getText()); 47 | return CommandResult.success(); 48 | } 49 | 50 | User targetPlayer = args.getOne("player1").get(); 51 | User targetPlayer2 = args.getOne("player2").get(); 52 | GriefPreventionPlugin.instance.setIgnoreStatus(player.getWorld(), targetPlayer, targetPlayer2, IgnoreMode.AdminIgnore); 53 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.playerSeparate.toText()); 54 | return CommandResult.success(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandTrust.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 29 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 30 | import org.spongepowered.api.command.CommandException; 31 | import org.spongepowered.api.command.CommandResult; 32 | import org.spongepowered.api.command.CommandSource; 33 | import org.spongepowered.api.command.args.CommandContext; 34 | import org.spongepowered.api.command.spec.CommandExecutor; 35 | import org.spongepowered.api.entity.living.player.User; 36 | 37 | public class CommandTrust implements CommandExecutor { 38 | 39 | @Override 40 | public CommandResult execute(CommandSource src, CommandContext ctx) { 41 | User user = ctx.getOne("user").orElse(null); 42 | String group = null; 43 | if (user == null) { 44 | group = ctx.getOne("group").orElse(null); 45 | if (group.equalsIgnoreCase("public") || group.equalsIgnoreCase("all")) { 46 | user = GriefPreventionPlugin.PUBLIC_USER; 47 | group = null; 48 | } 49 | } 50 | try { 51 | if (user != null) { 52 | CommandHelper.handleUserTrustCommand(GriefPreventionPlugin.checkPlayer(src), TrustType.BUILDER, user); 53 | } else { 54 | CommandHelper.handleGroupTrustCommand(GriefPreventionPlugin.checkPlayer(src), TrustType.BUILDER, group); 55 | } 56 | } catch (CommandException e) { 57 | src.sendMessage(e.getText()); 58 | } 59 | return CommandResult.success(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandUnlockDrops.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import org.spongepowered.api.command.CommandException; 31 | import org.spongepowered.api.command.CommandResult; 32 | import org.spongepowered.api.command.CommandSource; 33 | import org.spongepowered.api.command.args.CommandContext; 34 | import org.spongepowered.api.command.spec.CommandExecutor; 35 | import org.spongepowered.api.entity.living.player.Player; 36 | 37 | public class CommandUnlockDrops implements CommandExecutor { 38 | 39 | @Override 40 | public CommandResult execute(CommandSource src, CommandContext ctx) { 41 | Player player; 42 | try { 43 | player = GriefPreventionPlugin.checkPlayer(src); 44 | } catch (CommandException e) { 45 | src.sendMessage(e.getText()); 46 | return CommandResult.success(); 47 | } 48 | 49 | final GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 50 | playerData.dropsAreUnlocked = true; 51 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.playerDropUnlockConfirmation.toText()); 52 | return CommandResult.success(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/command/CommandUnseparate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.command; 27 | 28 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin.IgnoreMode; 30 | import org.spongepowered.api.command.CommandException; 31 | import org.spongepowered.api.command.CommandResult; 32 | import org.spongepowered.api.command.CommandSource; 33 | import org.spongepowered.api.command.args.CommandContext; 34 | import org.spongepowered.api.command.spec.CommandExecutor; 35 | import org.spongepowered.api.entity.living.player.Player; 36 | import org.spongepowered.api.entity.living.player.User; 37 | 38 | public class CommandUnseparate implements CommandExecutor { 39 | 40 | @Override 41 | public CommandResult execute(CommandSource src, CommandContext args) { 42 | Player player; 43 | try { 44 | player = GriefPreventionPlugin.checkPlayer(src); 45 | } catch (CommandException e) { 46 | src.sendMessage(e.getText()); 47 | return CommandResult.success(); 48 | } 49 | 50 | final User targetPlayer = args.getOne("player1").get(); 51 | final User targetPlayer2 = args.getOne("player2").get(); 52 | GriefPreventionPlugin.instance.setIgnoreStatus(player.getWorld(), targetPlayer, targetPlayer2, IgnoreMode.None); 53 | GriefPreventionPlugin.instance.setIgnoreStatus(player.getWorld(), targetPlayer2, targetPlayer, IgnoreMode.None); 54 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.playerUnseparate.toText()); 55 | return CommandResult.success(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/IClaimData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.ClaimType; 28 | import me.ryanhamshire.griefprevention.api.data.ClaimData; 29 | 30 | import java.util.List; 31 | import java.util.UUID; 32 | 33 | public interface IClaimData extends ClaimData { 34 | 35 | boolean requiresSave(); 36 | 37 | boolean isExpired(); 38 | 39 | List getAccessors(); 40 | 41 | List getBuilders(); 42 | 43 | List getContainers(); 44 | 45 | List getManagers(); 46 | 47 | List getAccessorGroups(); 48 | 49 | List getBuilderGroups(); 50 | 51 | List getContainerGroups(); 52 | 53 | List getManagerGroups(); 54 | 55 | void setOwnerUniqueId(UUID newClaimOwner); 56 | 57 | void setWorldUniqueId(UUID uuid); 58 | 59 | void setType(ClaimType type); 60 | 61 | void setCuboid(boolean cuboid); 62 | 63 | void setLesserBoundaryCorner(String location); 64 | 65 | void setGreaterBoundaryCorner(String location); 66 | 67 | void setAccessors(List accessors); 68 | 69 | void setBuilders(List builders); 70 | 71 | void setContainers(List containers); 72 | 73 | void setManagers(List coowners); 74 | 75 | void setRequiresSave(boolean flag); 76 | 77 | void setExpired(boolean expire); 78 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/PlayerDataConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration; 26 | 27 | import me.ryanhamshire.griefprevention.configuration.category.ConfigCategory; 28 | import ninja.leaping.configurate.objectmapping.Setting; 29 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 30 | 31 | @ConfigSerializable 32 | public class PlayerDataConfig extends ConfigCategory { 33 | 34 | private boolean requiresSave = true; 35 | 36 | @Setting(value = "accrued-claim-blocks", comment = "How many claim blocks the player has earned in world via play time.") 37 | private int accruedClaimBlocks; 38 | @Setting(value = "bonus-claim-blocks", 39 | comment = "How many claim blocks the player has been gifted in world by admins, or purchased via economy integration.") 40 | private int bonusClaimBlocks = 0; 41 | @Setting(value = "migrated-blocks") 42 | private boolean migrated = false; 43 | 44 | public int getAccruedClaimBlocks() { 45 | return this.accruedClaimBlocks; 46 | } 47 | 48 | public int getBonusClaimBlocks() { 49 | return this.bonusClaimBlocks; 50 | } 51 | 52 | public void setAccruedClaimBlocks(int blocks) { 53 | this.requiresSave = true; 54 | this.accruedClaimBlocks = blocks; 55 | } 56 | 57 | public void setBonusClaimBlocks(int blocks) { 58 | this.requiresSave = true; 59 | this.bonusClaimBlocks = blocks; 60 | } 61 | 62 | public boolean requiresSave() { 63 | return this.requiresSave; 64 | } 65 | 66 | public void setRequiresSave(boolean flag) { 67 | this.requiresSave = flag; 68 | } 69 | 70 | // Remove after 4.0 71 | public boolean hasMigratedBlocks() { 72 | return this.migrated; 73 | } 74 | 75 | public void setMigratedBlocks(boolean flag) { 76 | this.migrated = flag; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/TownDataConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration; 26 | 27 | import com.google.common.collect.Maps; 28 | import ninja.leaping.configurate.objectmapping.Setting; 29 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 30 | import org.spongepowered.api.text.Text; 31 | 32 | import java.util.Map; 33 | import java.util.Optional; 34 | import java.util.UUID; 35 | 36 | @ConfigSerializable 37 | public class TownDataConfig extends ClaimDataConfig { 38 | 39 | @Setting 40 | private Text townTag; 41 | @Setting 42 | private Map residentPastDueTaxTimestamps = Maps.newHashMap(); 43 | @Setting 44 | private Map residentTaxBalances = Maps.newHashMap(); 45 | 46 | public Optional getTownTag() { 47 | return Optional.ofNullable(this.townTag); 48 | } 49 | 50 | public void setTownTag(Text tag) { 51 | this.townTag = tag; 52 | } 53 | 54 | public Map getResidentPastDueTaxTimestamps() { 55 | return this.residentPastDueTaxTimestamps; 56 | } 57 | 58 | public Map getResidentTaxBalances() { 59 | return this.residentTaxBalances; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/TownStorageData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.ClaimType; 28 | 29 | import java.nio.file.Path; 30 | import java.util.UUID; 31 | 32 | public class TownStorageData extends ClaimStorageData { 33 | 34 | public TownStorageData(Path path, UUID worldUniqueId, UUID ownerUniqueId, boolean cuboid) { 35 | super(path, worldUniqueId, ownerUniqueId, ClaimType.TOWN, cuboid); 36 | } 37 | 38 | public TownStorageData(Path path, UUID worldUniqueId) { 39 | super(path, worldUniqueId); 40 | } 41 | 42 | public TownDataConfig getConfig() { 43 | return (TownDataConfig) this.configBase; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/BanCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import com.google.common.collect.Maps; 28 | import ninja.leaping.configurate.objectmapping.Setting; 29 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 30 | import org.spongepowered.api.text.Text; 31 | 32 | import java.util.Map; 33 | 34 | @ConfigSerializable 35 | public class BanCategory extends ConfigCategory { 36 | 37 | @Setting 38 | private Map banReasons = Maps.newHashMap(); 39 | 40 | public void addBan(String permission, Text reason) { 41 | permission = permission.replace("griefprevention.flag.", "").toLowerCase(); 42 | this.banReasons.put(permission, reason); 43 | } 44 | 45 | public void removeBan(String permission) { 46 | permission = permission.replace("griefprevention.flag.", "").toLowerCase(); 47 | this.banReasons.remove(permission); 48 | } 49 | 50 | public Text getReason(String permission) { 51 | permission = permission.replace("griefprevention.flag.", "").toLowerCase(); 52 | for (Map.Entry banEntry : this.banReasons.entrySet()) { 53 | if (permission.contains(banEntry.getKey())) { 54 | return banEntry.getValue(); 55 | } 56 | } 57 | return null; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/ConfigCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 28 | 29 | @ConfigSerializable 30 | public abstract class ConfigCategory { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/DatabaseCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.Setting; 28 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 29 | 30 | @ConfigSerializable 31 | public class DatabaseCategory extends ConfigCategory { 32 | 33 | @Setting(value = "password", comment = "password") 34 | public String dbPassword = ""; 35 | @Setting(value = "username", comment = "username") 36 | public String dbUsername = ""; 37 | @Setting(value = "url", comment = "url") 38 | public String dbURL = ""; 39 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/EconomyCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.Setting; 28 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 29 | 30 | @ConfigSerializable 31 | public class EconomyCategory extends ConfigCategory { 32 | 33 | @Setting(value = "claim-block-cost", comment = "Cost to purchase a claim block. set to zero to disable purchase.") 34 | public double economyClaimBlockCost = 0; 35 | @Setting(value = "claim-block-sell", comment = "Return on a sold claim block. set to zero to disable sale.") 36 | public double economyClaimBlockSell = 0; 37 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/LoggingCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.Setting; 28 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 29 | 30 | @ConfigSerializable 31 | public class LoggingCategory extends ConfigCategory { 32 | 33 | @Setting(value = "days-stored", comment = "How many days to keep logs in storage.") 34 | public int loggingDaysToKeep = 7; 35 | @Setting(value = "admin-activity", comment = "Log admin activity.") 36 | public boolean loggingAdminActivity = false; 37 | @Setting(value = "social-activity", comment = "Log social activity.") 38 | public boolean loggingSocialActions = false; 39 | @Setting(value = "suspicious-activity", comment = "Log suspicious activity.") 40 | public boolean loggingSuspiciousActivity = false; 41 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/MessageCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.Setting; 28 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 29 | 30 | @ConfigSerializable 31 | public class MessageCategory extends ConfigCategory { 32 | 33 | @Setting(value = "locale", comment = "Set the locale to use for GP messages. (Default: en_US)\n" + 34 | "Note: The language code must be lowercase and the country code must be uppercase.") 35 | public String locale = "en_US"; 36 | 37 | @Setting(value = "show-gp-prefix-greeting-farewell", comment = "Whether GP prefix should be shown in greeting/farewell claim messages. (Default: true)") 38 | public boolean showGpPrefixGreetingFarewell = true; 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/MigratorCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.Setting; 28 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 29 | 30 | @ConfigSerializable 31 | public class MigratorCategory extends ConfigCategory { 32 | 33 | @Setting(value = "red-protect", comment = 34 | "Set to true to enable RedProtect data migrator." + 35 | "\nNote: All RedProtect data will be converted into basic claim data.") 36 | public boolean redProtectMigrator = false; 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/SpamCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.Setting; 28 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 29 | 30 | import java.util.ArrayList; 31 | import java.util.List; 32 | 33 | @ConfigSerializable 34 | public class SpamCategory extends ConfigCategory { 35 | 36 | @Setting(value = "enable-spam-monitor", comment = "Whether or not to monitor for spam.") 37 | public boolean monitorEnabled = true; 38 | @Setting(value = "login-cooldown", comment = "How long players must wait between logins. combats login spam.") 39 | public int loginCooldown = 60; 40 | @Setting(value = "autoban-offenders", comment = "Whether or not to ban spammers automatically.") 41 | public boolean autoBanOffenders = false; 42 | @Setting(value = "monitor-commands", comment = "the list of slash commands monitored for spam,") 43 | public List monitoredCommandList = new ArrayList<>(); 44 | @Setting(value = "allowed-ips", comment = "IP addresses which will not be censored.") 45 | public List allowedIpAddresses = new ArrayList<>(); 46 | @Setting(value = "death-message-cooldown", comment = "Cooldown period for death messages (per player) in seconds.") 47 | public int deathMessageCooldown = 60; 48 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/ThreadCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.Setting; 28 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 29 | 30 | @ConfigSerializable 31 | public class ThreadCategory extends ConfigCategory { 32 | 33 | @Setting(value = "executor-threads", comment = "The number of threads to use for GP's executor. (Default: 1)") 34 | public int numExecutorThreads = 1; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/category/TownCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.category; 26 | 27 | import ninja.leaping.configurate.objectmapping.Setting; 28 | import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; 29 | 30 | @ConfigSerializable 31 | public class TownCategory extends ConfigCategory { 32 | 33 | @Setting(value = "cleanup-task-interval", comment = "The interval in minutes for restoring blocks in an expired town. Set to 0 to disable. Note: This only supports vanilla blocks. Use with caution if using custom biomes.") 34 | public int cleanupTaskInterval = 5; 35 | @Setting(value = "auto-nature-restore", comment = "Whether survival towns will be automatically restored to nature when auto-deleted.") 36 | public boolean autoNatureRestore = false; 37 | @Setting(value = "extend-into-ground-distance", comment = "How far below the shoveled block a new claim will reach. Set to 255 if you want to always extend to bedrock.") 38 | public int extendIntoGroundDistance = 255; 39 | @Setting(value = "max-depth", comment = "Limit on how deep towns can go.") 40 | public int maxClaimDepth = 0; 41 | @Setting(value = "creation-cost", comment = "The required amount of funds to create a town. (Default: 0)\nNote: This requires an Economy plugin.") 42 | public double cost = 0; 43 | @Setting(value = "clan-require-town", comment = "If true, requires a town to be owned for MCClans.") 44 | public boolean clanRequireTown = true; 45 | 46 | public TownCategory() { 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/configuration/type/GlobalConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.configuration.type; 26 | 27 | import me.ryanhamshire.griefprevention.configuration.category.BanCategory; 28 | import me.ryanhamshire.griefprevention.configuration.category.LoggingCategory; 29 | import me.ryanhamshire.griefprevention.configuration.category.MessageCategory; 30 | import me.ryanhamshire.griefprevention.configuration.category.MigratorCategory; 31 | import me.ryanhamshire.griefprevention.configuration.category.ModuleCategory; 32 | import me.ryanhamshire.griefprevention.configuration.category.PlayerDataCategory; 33 | import me.ryanhamshire.griefprevention.configuration.category.SpamCategory; 34 | import me.ryanhamshire.griefprevention.configuration.category.ThreadCategory; 35 | import ninja.leaping.configurate.objectmapping.Setting; 36 | 37 | public class GlobalConfig extends ConfigBase { 38 | 39 | @Setting 40 | public BanCategory bans = new BanCategory(); 41 | 42 | //@Setting 43 | //public DatabaseCategory database = new DatabaseCategory(); 44 | 45 | @Setting 46 | public LoggingCategory logging = new LoggingCategory(); 47 | 48 | @Setting 49 | public PlayerDataCategory playerdata = new PlayerDataCategory(); 50 | 51 | @Setting 52 | public SpamCategory spam = new SpamCategory(); 53 | 54 | @Setting 55 | public MessageCategory message = new MessageCategory(); 56 | 57 | @Setting(comment = 58 | "List of migrators that convert old or other protection data into the current GP claim data format." + 59 | "\nNote: It is recommended to backup data before using.") 60 | public MigratorCategory migrator = new MigratorCategory(); 61 | 62 | @Setting(value = "modules") 63 | public ModuleCategory modules = new ModuleCategory(); 64 | 65 | @Setting 66 | public ThreadCategory thread = new ThreadCategory(); 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPAttackPlayerEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import me.ryanhamshire.griefprevention.api.event.AttackPlayerEvent; 29 | import org.spongepowered.api.entity.living.player.Player; 30 | 31 | public class GPAttackPlayerEvent extends GPClaimEvent implements AttackPlayerEvent { 32 | 33 | private Player targetPlayer; 34 | 35 | public GPAttackPlayerEvent(Claim claim, Player targetPlayer) { 36 | super(claim); 37 | } 38 | 39 | @Override 40 | public Player getTargetEntity() { 41 | return this.targetPlayer; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; 26 | 27 | import com.google.common.collect.ImmutableList; 28 | import me.ryanhamshire.griefprevention.api.claim.Claim; 29 | import me.ryanhamshire.griefprevention.api.event.ClaimEvent; 30 | import org.spongepowered.api.Sponge; 31 | import org.spongepowered.api.event.cause.Cause; 32 | import org.spongepowered.api.event.impl.AbstractEvent; 33 | import org.spongepowered.api.text.Text; 34 | 35 | import java.util.List; 36 | import java.util.Optional; 37 | 38 | public class GPClaimEvent extends AbstractEvent implements ClaimEvent { 39 | 40 | private List claims; 41 | private Text message; 42 | private boolean isCancelled = false; 43 | private final Cause cause; 44 | 45 | public GPClaimEvent(Claim claim) { 46 | this.claims = ImmutableList.of(claim); 47 | this.cause = Sponge.getCauseStackManager().getCurrentCause(); 48 | } 49 | 50 | public GPClaimEvent(List claims) { 51 | this.claims = ImmutableList.copyOf(claims); 52 | this.cause = Sponge.getCauseStackManager().getCurrentCause(); 53 | } 54 | 55 | @Override 56 | public boolean isCancelled() { 57 | return this.isCancelled; 58 | } 59 | 60 | @Override 61 | public void setCancelled(boolean cancel) { 62 | this.isCancelled = cancel; 63 | } 64 | 65 | @Override 66 | public Cause getCause() { 67 | return this.cause; 68 | } 69 | 70 | @Override 71 | public List getClaims() { 72 | return this.claims; 73 | } 74 | 75 | @Override 76 | public void setMessage(Text message) { 77 | this.message = message; 78 | } 79 | 80 | @Override 81 | public Optional getMessage() { 82 | return Optional.ofNullable(this.message); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPCreateClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import me.ryanhamshire.griefprevention.api.event.CreateClaimEvent; 29 | 30 | public class GPCreateClaimEvent extends GPClaimEvent implements CreateClaimEvent { 31 | 32 | public GPCreateClaimEvent(Claim claim) { 33 | super(claim); 34 | } 35 | 36 | public static class Pre extends GPCreateClaimEvent { 37 | 38 | public Pre(Claim claim) { 39 | super(claim); 40 | } 41 | } 42 | 43 | public static class Post extends GPCreateClaimEvent { 44 | 45 | public Post(Claim claim) { 46 | super(claim); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPDeleteClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.event; 27 | 28 | import me.ryanhamshire.griefprevention.api.claim.Claim; 29 | import me.ryanhamshire.griefprevention.api.event.DeleteClaimEvent; 30 | 31 | import java.util.List; 32 | 33 | public class GPDeleteClaimEvent extends GPClaimEvent implements DeleteClaimEvent { 34 | 35 | public GPDeleteClaimEvent(Claim claim) { 36 | super(claim); 37 | } 38 | 39 | public GPDeleteClaimEvent(List claims) { 40 | super(claims); 41 | } 42 | 43 | public static class Abandon extends GPDeleteClaimEvent implements DeleteClaimEvent.Abandon { 44 | 45 | public Abandon(Claim claim) { 46 | super(claim); 47 | } 48 | 49 | public Abandon(List claims) { 50 | super(claims); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPGroupTrustClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 29 | import me.ryanhamshire.griefprevention.api.event.GroupTrustClaimEvent; 30 | 31 | import java.util.List; 32 | 33 | public class GPGroupTrustClaimEvent extends GPTrustClaimEvent implements GroupTrustClaimEvent { 34 | 35 | private List groups; 36 | 37 | public GPGroupTrustClaimEvent(Claim claim, List groups, TrustType trustType) { 38 | super(claim, trustType); 39 | this.groups = groups; 40 | } 41 | 42 | public GPGroupTrustClaimEvent(List claims, List groups, TrustType trustType) { 43 | super(claims, trustType); 44 | this.groups = groups; 45 | } 46 | 47 | @Override 48 | public List getGroups() { 49 | return this.groups; 50 | } 51 | 52 | public static class Add extends GPGroupTrustClaimEvent implements GroupTrustClaimEvent.Add { 53 | public Add(List claims, List groups, TrustType trustType) { 54 | super(claims, groups, trustType); 55 | } 56 | 57 | public Add(Claim claim, List groups, TrustType trustType) { 58 | super(claim, groups, trustType); 59 | } 60 | } 61 | 62 | public static class Remove extends GPGroupTrustClaimEvent implements GroupTrustClaimEvent.Remove { 63 | public Remove(List claims, List groups, TrustType trustType) { 64 | super(claims, groups, trustType); 65 | } 66 | 67 | public Remove(Claim claim, List groups, TrustType trustType) { 68 | super(claim, groups, trustType); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPTaxClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import me.ryanhamshire.griefprevention.api.event.TaxClaimEvent; 29 | 30 | public class GPTaxClaimEvent extends GPClaimEvent implements TaxClaimEvent { 31 | 32 | private final double originalTaxRate; 33 | private final double originalTaxAmount; 34 | private double taxRate; 35 | 36 | public GPTaxClaimEvent(Claim claim, double rate, double amount) { 37 | super(claim); 38 | this.originalTaxRate = rate; 39 | this.originalTaxAmount = amount; 40 | this.taxRate = rate; 41 | } 42 | 43 | @Override 44 | public double getOriginalTaxRate() { 45 | return this.originalTaxRate; 46 | } 47 | 48 | @Override 49 | public double getOriginalTaxAmount() { 50 | return this.originalTaxAmount; 51 | } 52 | 53 | @Override 54 | public double getTaxRate() { 55 | return this.taxRate; 56 | } 57 | 58 | @Override 59 | public double getTaxAmount() { 60 | return (this.getClaim().getClaimBlocks() / 256) * this.taxRate; 61 | } 62 | 63 | @Override 64 | public void setTaxRate(double newTaxRate) { 65 | this.taxRate = newTaxRate; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPTransferClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import me.ryanhamshire.griefprevention.api.event.TransferClaimEvent; 29 | 30 | import java.util.UUID; 31 | 32 | public class GPTransferClaimEvent extends GPClaimEvent implements TransferClaimEvent { 33 | 34 | private UUID originalOwner; 35 | private UUID newOwner; 36 | 37 | public GPTransferClaimEvent(Claim claim, UUID originalOwner, UUID newOwner) { 38 | super(claim); 39 | this.originalOwner = originalOwner; 40 | this.newOwner = newOwner; 41 | } 42 | 43 | @Override 44 | public UUID getOriginalOwner() { 45 | return this.originalOwner; 46 | } 47 | 48 | @Override 49 | public UUID getNewOwner() { 50 | return this.newOwner; 51 | } 52 | 53 | @Override 54 | public void setNewOwner(UUID newOwner) { 55 | this.newOwner = newOwner; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPTrustClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 29 | import me.ryanhamshire.griefprevention.api.event.TrustClaimEvent; 30 | 31 | import java.util.List; 32 | 33 | public class GPTrustClaimEvent extends GPClaimEvent implements TrustClaimEvent { 34 | 35 | private TrustType trustType; 36 | 37 | public GPTrustClaimEvent(Claim claim, TrustType trustType) { 38 | super(claim); 39 | this.trustType = trustType; 40 | } 41 | 42 | public GPTrustClaimEvent(List claims, TrustType trustType) { 43 | super(claims); 44 | this.trustType = trustType; 45 | } 46 | 47 | @Override 48 | public TrustType getTrustType() { 49 | return this.trustType; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/GPUserTrustClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 29 | import me.ryanhamshire.griefprevention.api.event.UserTrustClaimEvent; 30 | 31 | import java.util.List; 32 | import java.util.UUID; 33 | 34 | public class GPUserTrustClaimEvent extends GPTrustClaimEvent implements UserTrustClaimEvent { 35 | 36 | private List users; 37 | 38 | public GPUserTrustClaimEvent(Claim claim, List users, TrustType trustType) { 39 | super(claim, trustType); 40 | this.users = users; 41 | } 42 | 43 | public GPUserTrustClaimEvent(List claims, List users, TrustType trustType) { 44 | super(claims, trustType); 45 | this.users = users; 46 | } 47 | 48 | @Override 49 | public List getUsers() { 50 | return this.users; 51 | } 52 | 53 | public static class Add extends GPUserTrustClaimEvent implements UserTrustClaimEvent.Add { 54 | public Add(List claims, List users, TrustType trustType) { 55 | super(claims, users, trustType); 56 | } 57 | 58 | public Add(Claim claim, List users, TrustType trustType) { 59 | super(claim, users, trustType); 60 | } 61 | } 62 | 63 | public static class Remove extends GPUserTrustClaimEvent implements UserTrustClaimEvent.Remove { 64 | public Remove(List claims,List users, TrustType trustType) { 65 | super(claims, users, trustType); 66 | } 67 | 68 | public Remove(Claim claim, List users, TrustType trustType) { 69 | super(claim, users, trustType); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/event/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.event; -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/listener/NucleusEventHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.listener; 26 | 27 | import io.github.nucleuspowered.nucleus.api.events.NucleusHomeEvent; 28 | import me.ryanhamshire.griefprevention.DataStore; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import me.ryanhamshire.griefprevention.api.claim.TrustType; 31 | import me.ryanhamshire.griefprevention.claim.GPClaim; 32 | import org.spongepowered.api.event.Listener; 33 | import org.spongepowered.api.world.Location; 34 | import org.spongepowered.api.world.World; 35 | 36 | public class NucleusEventHandler { 37 | 38 | private static final DataStore DATASTORE = GriefPreventionPlugin.instance.dataStore; 39 | 40 | @Listener 41 | public void onSetHome(NucleusHomeEvent.Create event) { 42 | Location location = event.getLocation().orElse(null); 43 | if (location == null) { 44 | return; 45 | } 46 | 47 | GPClaim claim = DATASTORE.getClaimAt(location); 48 | if (claim != null && !claim.isWilderness() && !claim.isAdminClaim()) { 49 | if (!claim.isUserTrusted(event.getUser(), TrustType.ACCESSOR)) { 50 | event.setCancelled(true); 51 | event.setCancelMessage(GriefPreventionPlugin.instance.messageData.nucleusNoSetHome.toText()); 52 | } 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/logging/CustomLogEntryTypes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.logging; 26 | 27 | public enum CustomLogEntryTypes { 28 | SocialActivity, 29 | SuspiciousActivity, 30 | AdminActivity, 31 | Debug, 32 | Exception 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/provider/MCClansApiProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.provider; 26 | 27 | import nl.riebie.mcclans.api.ClanService; 28 | import org.spongepowered.api.Sponge; 29 | 30 | public class MCClansApiProvider { 31 | 32 | private final ClanService clanService; 33 | 34 | public MCClansApiProvider() { 35 | this.clanService = Sponge.getServiceManager().provide(ClanService.class).orElse(null); 36 | } 37 | 38 | public ClanService getClanService() { 39 | return this.clanService; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/provider/worldedit/cui/MultiSelectionColors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.provider.worldedit.cui; 26 | 27 | import me.ryanhamshire.griefprevention.api.claim.Claim; 28 | 29 | public class MultiSelectionColors { 30 | 31 | public static final String RED = "#990000"; 32 | public static final String GREEN = "#5AC25A"; 33 | public static final String YELLOW = "#EAEA32"; 34 | public static final String GRAY = "#D2D2D2"; 35 | 36 | public static String getClaimColor(Claim claim) { 37 | if (claim.isSubdivision()) { 38 | return GRAY; 39 | } 40 | if (claim.isAdminClaim()) { 41 | return RED; 42 | } 43 | if (claim.isTown()) { 44 | return GREEN; 45 | } 46 | return YELLOW; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/provider/worldedit/cui/MultiSelectionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.provider.worldedit.cui; 26 | 27 | public class MultiSelectionType { 28 | 29 | public static final String COLOR = "+col"; 30 | public static final String GRID = "+grid"; 31 | public static final String GRID_CULL = "cull"; 32 | public static final String POINT = "+p"; 33 | public static final String SELECTION = "+s"; 34 | public static final String SELECTION_CLEAR = "+s|clear"; 35 | public static final String SELECTION_CUBOID = "+s|cuboid"; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/provider/worldedit/cui/event/MultiSelectionClearEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.provider.worldedit.cui.event; 26 | 27 | import com.sk89q.worldedit.internal.cui.CUIEvent; 28 | import me.ryanhamshire.griefprevention.provider.worldedit.cui.MultiSelectionType; 29 | 30 | import java.util.UUID; 31 | 32 | public class MultiSelectionClearEvent implements CUIEvent { 33 | 34 | private final String[] parameters; 35 | 36 | public MultiSelectionClearEvent() { 37 | this.parameters = new String[] {}; 38 | } 39 | 40 | public MultiSelectionClearEvent(UUID uniqueId) { 41 | this.parameters = new String[] { 42 | uniqueId.toString()}; 43 | } 44 | @Override 45 | public String[] getParameters() { 46 | return this.parameters; 47 | } 48 | 49 | @Override 50 | public String getTypeId() { 51 | return MultiSelectionType.SELECTION_CLEAR; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/provider/worldedit/cui/event/MultiSelectionColorEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.provider.worldedit.cui.event; 26 | 27 | import com.sk89q.worldedit.internal.cui.CUIEvent; 28 | import me.ryanhamshire.griefprevention.provider.worldedit.cui.MultiSelectionType; 29 | 30 | public class MultiSelectionColorEvent implements CUIEvent { 31 | 32 | private final String edgeColor; 33 | private final String gridColor; 34 | private final String p1Color; 35 | private final String p2Color; 36 | private final String[] parameters; 37 | 38 | public MultiSelectionColorEvent(String edgeColor, String gridColor, String p1Color, String p2Color) { 39 | this.edgeColor = edgeColor; 40 | this.gridColor = gridColor; 41 | this.p1Color = p1Color; 42 | this.p2Color = p2Color; 43 | this.parameters = new String[] { 44 | this.edgeColor, 45 | this.gridColor, 46 | this.p1Color, 47 | this.p2Color}; 48 | } 49 | 50 | @Override 51 | public String getTypeId() { 52 | return MultiSelectionType.COLOR; 53 | } 54 | 55 | @Override 56 | public String[] getParameters() { 57 | return this.parameters; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/provider/worldedit/cui/event/MultiSelectionCuboidEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.provider.worldedit.cui.event; 26 | 27 | import com.sk89q.worldedit.internal.cui.CUIEvent; 28 | import me.ryanhamshire.griefprevention.provider.worldedit.cui.MultiSelectionType; 29 | 30 | import java.util.UUID; 31 | 32 | public class MultiSelectionCuboidEvent implements CUIEvent { 33 | 34 | protected final UUID uniqueId; 35 | private final String[] parameters; 36 | 37 | public MultiSelectionCuboidEvent(UUID uniqueId) { 38 | this.uniqueId = uniqueId; 39 | this.parameters = new String[] { 40 | String.valueOf(this.uniqueId) 41 | }; 42 | } 43 | 44 | @Override 45 | public String getTypeId() { 46 | return MultiSelectionType.SELECTION_CUBOID; 47 | } 48 | 49 | @Override 50 | public String[] getParameters() { 51 | return this.parameters; 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/provider/worldedit/cui/event/MultiSelectionGridEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.provider.worldedit.cui.event; 26 | 27 | import com.sk89q.worldedit.internal.cui.CUIEvent; 28 | import me.ryanhamshire.griefprevention.provider.worldedit.cui.MultiSelectionType; 29 | 30 | public class MultiSelectionGridEvent implements CUIEvent { 31 | 32 | final String[] parameters; 33 | 34 | public MultiSelectionGridEvent(double spacing) { 35 | this.parameters = new String[] { String.valueOf(spacing), 36 | MultiSelectionType.GRID_CULL}; 37 | } 38 | 39 | @Override 40 | public String[] getParameters() { 41 | return this.parameters; 42 | } 43 | 44 | @Override 45 | public String getTypeId() { 46 | return MultiSelectionType.GRID; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/provider/worldedit/cui/event/MultiSelectionPointEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.provider.worldedit.cui.event; 26 | 27 | import com.sk89q.worldedit.Vector; 28 | import com.sk89q.worldedit.internal.cui.CUIEvent; 29 | import me.ryanhamshire.griefprevention.provider.worldedit.cui.MultiSelectionType; 30 | 31 | public class MultiSelectionPointEvent implements CUIEvent { 32 | 33 | private final String TILDE = "~"; 34 | private final String[] parameters; 35 | 36 | // Used to force WECUI to follow player EYE 37 | public MultiSelectionPointEvent(int id) { 38 | this.parameters = new String[] { 39 | String.valueOf(id), 40 | TILDE, 41 | TILDE, 42 | TILDE, 43 | String.valueOf(0)}; 44 | } 45 | 46 | public MultiSelectionPointEvent(int id, Vector pos, int area) { 47 | this.parameters = new String[] { 48 | String.valueOf(id), 49 | String.valueOf(pos.getX()), 50 | String.valueOf(pos.getY()), 51 | String.valueOf(pos.getZ()), 52 | String.valueOf(area)}; 53 | } 54 | 55 | @Override 56 | public String getTypeId() { 57 | return MultiSelectionType.POINT; 58 | } 59 | 60 | @Override 61 | public String[] getParameters() { 62 | return this.parameters; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/task/CheckForPortalTrapTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.task; 27 | 28 | import org.spongepowered.api.block.BlockTypes; 29 | import org.spongepowered.api.entity.living.player.Player; 30 | import org.spongepowered.api.world.Location; 31 | import org.spongepowered.api.world.World; 32 | 33 | //players can be "trapped" in a portal frame if they don't have permission to break 34 | //solid blocks blocking them from exiting the frame 35 | //if that happens, we detect the problem and send them back through the portal. 36 | public class CheckForPortalTrapTask implements Runnable { 37 | 38 | // player who recently teleported via nether portal 39 | private Player player; 40 | 41 | // where to send the player back to if he hasn't left the portal frame 42 | private Location returnLocation; 43 | 44 | public CheckForPortalTrapTask(Player player, Location location) { 45 | this.player = player; 46 | this.returnLocation = location; 47 | } 48 | 49 | @Override 50 | public void run() { 51 | // if player has logged out, do nothing 52 | if (!this.player.isOnline()) { 53 | return; 54 | } 55 | 56 | // otherwise if still standing in a portal frame, teleport him back 57 | // through 58 | if (this.player.getLocation().getBlockType().equals(BlockTypes.PORTAL)) { 59 | this.player.setLocation(returnLocation); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/task/PlayerKickBanTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.task; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import org.spongepowered.api.Sponge; 30 | import org.spongepowered.api.entity.living.player.Player; 31 | import org.spongepowered.api.service.ban.BanService; 32 | import org.spongepowered.api.text.Text; 33 | import org.spongepowered.api.util.ban.Ban; 34 | import org.spongepowered.api.util.ban.BanTypes; 35 | 36 | //kicks or bans a player 37 | //need a task for this because async threads (like the chat event handlers) can't kick or ban. 38 | //but they CAN schedule a task to run in the main thread to do that job 39 | public class PlayerKickBanTask implements Runnable { 40 | 41 | private final BanService banService = Sponge.getServiceManager().getRegistration(BanService.class).get().getProvider(); 42 | 43 | // player to kick or ban 44 | private Player player; 45 | 46 | // message to send player. 47 | private Text reason; 48 | 49 | // source of ban 50 | private Text source; 51 | 52 | // whether to ban 53 | private boolean ban; 54 | 55 | public PlayerKickBanTask(Player player, Text reason, Text source, boolean ban) { 56 | this.player = player; 57 | this.reason = reason; 58 | this.source = source; 59 | this.ban = ban; 60 | } 61 | 62 | @Override 63 | public void run() { 64 | if (this.ban) { 65 | final Ban banProfile = Ban.builder() 66 | .type(BanTypes.PROFILE) 67 | .source(this.source) 68 | .profile(player.getProfile()) 69 | .reason(this.reason) 70 | .build(); 71 | this.banService.addBan(banProfile); 72 | this.player.kick(this.reason); 73 | } else { 74 | this.player.kick(this.reason); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/task/PvPImmunityValidationTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.task; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import org.spongepowered.api.Sponge; 31 | import org.spongepowered.api.entity.living.player.Player; 32 | 33 | import java.util.concurrent.TimeUnit; 34 | 35 | //sends a message to a player 36 | //used to send delayed messages, for example help text triggered by a player's chat 37 | public class PvPImmunityValidationTask implements Runnable { 38 | 39 | private Player player; 40 | 41 | public PvPImmunityValidationTask(Player player) { 42 | this.player = player; 43 | } 44 | 45 | @Override 46 | public void run() { 47 | if (!player.isOnline()) { 48 | return; 49 | } 50 | 51 | GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId()); 52 | if (!playerData.pvpImmune) { 53 | return; 54 | } 55 | 56 | // check the player's inventory for anything 57 | if (!GriefPreventionPlugin.isInventoryEmpty(player)) { 58 | // if found, cancel invulnerability and notify 59 | playerData.pvpImmune = false; 60 | GriefPreventionPlugin.sendMessage(player, GriefPreventionPlugin.instance.messageData.pvpImmunityStart.toText()); 61 | } else { 62 | // otherwise check again in one minute 63 | Sponge.getGame().getScheduler().createTaskBuilder().delay(1, TimeUnit.MINUTES).execute(this).submit(GriefPreventionPlugin.instance); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/task/SendPlayerMessageTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.task; 27 | 28 | import me.ryanhamshire.griefprevention.GPPlayerData; 29 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 30 | import org.spongepowered.api.entity.living.player.Player; 31 | import org.spongepowered.api.text.Text; 32 | 33 | //sends a message to a player 34 | //used to send delayed messages, for example help text triggered by a player's chat 35 | public class SendPlayerMessageTask implements Runnable { 36 | 37 | private Player player; 38 | private Text message; 39 | 40 | public SendPlayerMessageTask(Player player, Text message) { 41 | this.player = player; 42 | this.message = message; 43 | } 44 | 45 | @Override 46 | public void run() { 47 | if (player == null) { 48 | GriefPreventionPlugin.addLogEntry(Text.of(message).toPlain()); 49 | return; 50 | } 51 | 52 | // if the player is dead, save it for after his respawn 53 | if (((net.minecraft.entity.player.EntityPlayerMP) this.player).isDead) { 54 | GPPlayerData playerData = GriefPreventionPlugin.instance.dataStore.getOrCreatePlayerData(this.player.getWorld(), this.player.getUniqueId()); 55 | playerData.messageOnRespawn = this.message; 56 | } 57 | 58 | // otherwise send it immediately 59 | else { 60 | GriefPreventionPlugin.sendMessage(this.player, Text.of(this.message)); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/task/VisualizationReversionTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.task; 26 | 27 | import me.ryanhamshire.griefprevention.GPPlayerData; 28 | import me.ryanhamshire.griefprevention.GriefPreventionPlugin; 29 | import org.spongepowered.api.entity.living.player.Player; 30 | 31 | //applies a visualization for a player by sending him block change packets 32 | class VisualizationReversionTask implements Runnable { 33 | 34 | private Player player; 35 | private GPPlayerData playerData; 36 | 37 | public VisualizationReversionTask(Player player, GPPlayerData playerData) { 38 | this.playerData = playerData; 39 | this.player = player; 40 | } 41 | 42 | @Override 43 | public void run() { 44 | // don't do anything if the player's current visualization is different 45 | // from the one scheduled to revert 46 | if (this.playerData.visualBlocks == null) { 47 | return; 48 | } 49 | 50 | // check for any active WECUI visuals 51 | if (GriefPreventionPlugin.instance.worldEditProvider != null) { 52 | GriefPreventionPlugin.instance.worldEditProvider.revertVisuals(this.player, this.playerData, this.playerData.visualClaimId); 53 | } 54 | this.playerData.revertActiveVisual(this.player); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/util/BlockPosCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.util; 26 | 27 | import org.spongepowered.api.util.Tristate; 28 | import org.spongepowered.common.SpongeImpl; 29 | 30 | public class BlockPosCache { 31 | 32 | private int lastTickCounter; 33 | private short lastBlockPos; 34 | private Tristate lastResult = Tristate.UNDEFINED; 35 | 36 | public BlockPosCache(short pos) { 37 | this.lastBlockPos = pos; 38 | this.lastTickCounter = SpongeImpl.getServer().getTickCounter(); 39 | } 40 | 41 | public void setLastResult(Tristate result) { 42 | this.lastResult = result; 43 | } 44 | 45 | public Tristate getCacheResult(short pos) { 46 | int currentTick = SpongeImpl.getServer().getTickCounter(); 47 | if (this.lastBlockPos != pos) { 48 | this.lastBlockPos = pos; 49 | this.lastTickCounter = currentTick; 50 | return Tristate.UNDEFINED; 51 | } 52 | 53 | if ((currentTick - this.lastTickCounter) <= 2) { 54 | this.lastTickCounter = currentTick; 55 | return this.lastResult; 56 | } 57 | 58 | this.lastTickCounter = currentTick; 59 | return Tristate.UNDEFINED; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/util/ClaimClickData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.util; 26 | 27 | import me.ryanhamshire.griefprevention.claim.GPClaim; 28 | 29 | public class ClaimClickData { 30 | public final GPClaim claim; 31 | public final Object value; 32 | 33 | public ClaimClickData(GPClaim claim, Object value) { 34 | this.claim = claim; 35 | this.value = value; 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/util/EntityUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of Sponge, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) SpongePowered 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.util; 26 | 27 | import net.minecraft.entity.IEntityOwnable; 28 | import net.minecraft.entity.player.EntityPlayer; 29 | import org.spongepowered.api.entity.Entity; 30 | 31 | import java.util.UUID; 32 | 33 | public class EntityUtils { 34 | 35 | public static UUID getOwnerUniqueId(Entity entity) { 36 | if (entity instanceof EntityPlayer) { 37 | return null; 38 | } 39 | 40 | UUID ownerUniqueId = entity.getCreator().orElse(null); 41 | if (ownerUniqueId == null && entity instanceof IEntityOwnable) { 42 | IEntityOwnable ownable = (IEntityOwnable) entity; 43 | ownerUniqueId = ownable.getOwnerId(); 44 | } 45 | 46 | return ownerUniqueId; 47 | } 48 | 49 | public static String getFriendlyName(net.minecraft.entity.Entity mcEntity) { 50 | String entityName = mcEntity.getName(); 51 | final String[] parts = entityName.split(":"); 52 | if (parts.length > 1) { 53 | entityName = parts[1]; 54 | } 55 | if (entityName.contains(".")) { 56 | if ((entityName.indexOf(".") + 1) < entityName.length()) { 57 | entityName = entityName.substring(entityName.indexOf(".") + 1, entityName.length()); 58 | } 59 | } 60 | 61 | entityName = entityName.replace("entity", ""); 62 | entityName = entityName.replaceAll("[^A-Za-z0-9]", ""); 63 | return entityName; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/util/NbtDataHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) bloodmc 5 | * Copyright (c) contributors 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is 12 | * furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in 15 | * all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | package me.ryanhamshire.griefprevention.util; 26 | 27 | import net.minecraft.entity.player.EntityPlayer; 28 | import net.minecraft.nbt.NBTTagCompound; 29 | import org.spongepowered.api.Sponge; 30 | import org.spongepowered.api.entity.living.player.User; 31 | import org.spongepowered.api.service.user.UserStorageService; 32 | 33 | import java.util.Optional; 34 | import java.util.UUID; 35 | 36 | public class NbtDataHelper { 37 | 38 | public static final String FORGE_DATA = "ForgeData"; 39 | public static final String SPONGE_DATA = "SpongeData"; 40 | public static final String SPONGE_ENTITY_CREATOR = "Creator"; 41 | 42 | public static Optional getOwnerOfEntity(net.minecraft.entity.Entity entity) { 43 | NBTTagCompound nbt = new NBTTagCompound(); 44 | entity.writeToNBT(nbt); 45 | if (nbt.hasKey(FORGE_DATA)) { 46 | NBTTagCompound forgeNBT = nbt.getCompoundTag(FORGE_DATA); 47 | if (forgeNBT.hasKey(SPONGE_DATA) && forgeNBT.getCompoundTag(SPONGE_DATA).hasKey(SPONGE_ENTITY_CREATOR)) { 48 | NBTTagCompound creatorNBT = forgeNBT.getCompoundTag(SPONGE_DATA).getCompoundTag(SPONGE_ENTITY_CREATOR); 49 | UUID uuid = new UUID(creatorNBT.getLong("uuid_most"), creatorNBT.getLong("uuid_least")); 50 | // get player if online 51 | EntityPlayer player = entity.world.getPlayerEntityByUUID(uuid); 52 | if (player != null) { 53 | return Optional.of((User) player); 54 | } 55 | // player is not online, get user from storage if one exists 56 | return Sponge.getGame().getServiceManager().provide(UserStorageService.class).get().get(uuid); 57 | } 58 | } 59 | return Optional.empty(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/util/TaskUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.util; 27 | 28 | import java.time.Duration; 29 | import java.time.LocalDateTime; 30 | import java.time.ZoneId; 31 | import java.time.ZonedDateTime; 32 | 33 | public class TaskUtils { 34 | 35 | public static long computeDelay(int targetHour, int targetMin, int targetSec) 36 | { 37 | LocalDateTime localNow = LocalDateTime.now(); 38 | ZoneId currentZone = ZoneId.systemDefault(); 39 | ZonedDateTime zonedNow = ZonedDateTime.of(localNow, currentZone); 40 | ZonedDateTime zonedNextTarget = zonedNow.withHour(targetHour).withMinute(targetMin).withSecond(targetSec); 41 | if(zonedNow.compareTo(zonedNextTarget) > 0) { 42 | zonedNextTarget = zonedNextTarget.plusDays(1); 43 | } 44 | 45 | Duration duration = Duration.between(zonedNow, zonedNextTarget); 46 | return duration.getSeconds(); 47 | } 48 | 49 | public static ZonedDateTime getNextTargetZoneDate(int targetHour, int targetMin, int targetSec) { 50 | LocalDateTime localNow = LocalDateTime.now(); 51 | ZoneId currentZone = ZoneId.systemDefault(); 52 | ZonedDateTime zonedNow = ZonedDateTime.of(localNow, currentZone); 53 | ZonedDateTime zonedNextTarget = zonedNow.withHour(targetHour).withMinute(targetMin).withSecond(targetSec); 54 | if(zonedNow.compareTo(zonedNextTarget) > 0) { 55 | zonedNextTarget = zonedNextTarget.plusDays(1); 56 | } 57 | return zonedNextTarget; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/me/ryanhamshire/griefprevention/visual/VisualizationType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GriefPrevention, licensed under the MIT License (MIT). 3 | * 4 | * Copyright (c) Ryan Hamshire 5 | * Copyright (c) bloodmc 6 | * Copyright (c) contributors 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | package me.ryanhamshire.griefprevention.visual; 27 | 28 | //just an enumeration of the visualization types, which determine what materials will be for the fake blocks 29 | public enum VisualizationType { 30 | CLAIM, 31 | SUBDIVISION, 32 | ERROR, 33 | RESTORENATURE, 34 | ADMINCLAIM, 35 | TOWN 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/bstats/sponge/Metrics.java: -------------------------------------------------------------------------------- 1 | package org.bstats.sponge; 2 | 3 | import com.google.gson.JsonObject; 4 | import org.spongepowered.api.plugin.PluginContainer; 5 | 6 | import java.util.List; 7 | 8 | public interface Metrics { 9 | /** 10 | * Cancels this instance's scheduled data sending. 11 | */ 12 | void cancel(); 13 | 14 | /** 15 | * Gets all metrics instances known to this instance. 16 | * For taking over if replacing an older version. 17 | * 18 | * @return all known metrics instances to this instance 19 | */ 20 | List getKnownMetricsInstances(); 21 | 22 | /** 23 | * Gets the plugin specific data 24 | * 25 | * @return the plugin specific data or null if failure to acquire 26 | */ 27 | JsonObject getPluginData(); 28 | 29 | /** 30 | * Gets the plugin container for this instance. 31 | * 32 | * @return plugin container 33 | */ 34 | PluginContainer getPluginContainer(); 35 | 36 | /** 37 | * Gets the revision of this bStats instance. 38 | * 39 | * @return revision 40 | */ 41 | int getRevision(); 42 | 43 | /** 44 | * Links another metrics instance to this one, which should be the master instance. 45 | * 46 | * @param metrics metrics instance 47 | */ 48 | void linkMetrics(Metrics metrics); 49 | } -------------------------------------------------------------------------------- /src/main/resources/META-INF/griefprevention_at.cfg: -------------------------------------------------------------------------------- 1 | public net.minecraft.world.gen.ChunkProviderServer field_73247_e # chunkLoader 2 | public net.minecraft.world.gen.ChunkProviderServer field_73244_f # id2ChunkMap 3 | public net.minecraft.world.gen.ChunkProviderServer field_186029_c # chunkGenerator 4 | public net.minecraft.server.management.PlayerChunkMapEntry field_187286_f # chunk --------------------------------------------------------------------------------