├── .gitmodules ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── settings.gradle ├── gradle.properties ├── bukkit ├── loader │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── plugin.yml │ │ │ ├── LICENSE.txt │ │ │ └── assets │ │ │ │ └── lang │ │ │ │ ├── zh_HK.conf │ │ │ │ ├── zh_CN.conf │ │ │ │ ├── pl_PL.conf │ │ │ │ ├── ru_RU.conf │ │ │ │ ├── de_DE.conf │ │ │ │ ├── it_IT.conf │ │ │ │ ├── fr_FR.conf │ │ │ │ ├── en_US.conf │ │ │ │ └── es_ES.conf │ │ │ └── java │ │ │ └── com │ │ │ └── griefdefender │ │ │ └── hooks │ │ │ └── loader │ │ │ └── BukkitLoaderPlugin.java │ └── build.gradle └── src │ └── main │ └── java │ └── com │ └── griefdefender │ └── hooks │ ├── config │ ├── category │ │ ├── ClanCategory.java │ │ ├── ConfigCategory.java │ │ ├── MessageCategory.java │ │ ├── BluemapOwnerStyleCategory.java │ │ ├── DynmapOwnerStyleCategory.java │ │ ├── SquaremapOwnerStyleCategory.java │ │ ├── ProviderCategory.java │ │ └── SquaremapCategory.java │ ├── GDHooksConfigData.java │ ├── MessageConfigData.java │ ├── ClanConfig.java │ ├── GDHooksConfig.java │ └── ClanConfigData.java │ ├── provider │ ├── clan │ │ ├── simpleclans │ │ │ ├── CreateClaimBukkitEvent.java │ │ │ ├── GDRank.java │ │ │ ├── GDClanPlayer.java │ │ │ └── SimpleClanProtectionProvider.java │ │ ├── uclans │ │ │ ├── GDRank.java │ │ │ └── GDClanPlayer.java │ │ ├── towny │ │ │ ├── GDRank.java │ │ │ └── GDClanPlayer.java │ │ ├── parties │ │ │ ├── GDRank.java │ │ │ └── GDClanPlayer.java │ │ ├── guilds │ │ │ ├── GDRank.java │ │ │ └── GDClanPlayer.java │ │ └── GDClanHome.java │ ├── shop │ │ ├── GDShopProvider.java │ │ ├── ShopProvider.java │ │ ├── QuickShopProvider.java │ │ ├── TradeShopProvider.java │ │ ├── SlabboProvider.java │ │ ├── ShopChestProvider.java │ │ ├── DynamicShopProvider.java │ │ ├── UltimateShopsProvider.java │ │ ├── InsaneShopsProvider.java │ │ ├── ChestShopProvider.java │ │ └── BossShopProvider.java │ ├── RevoltCratesProvider.java │ ├── CustomItemsProvider.java │ ├── mcmmo │ │ └── McMMOPlayerAbilityData.java │ ├── FurnitureLibProvider.java │ ├── ItemsAdderProvider.java │ └── BreweryProvider.java │ ├── GDHooksAttributes.java │ ├── plugin │ ├── ClassPathAppender.java │ └── JarInJarClassPathAppender.java │ ├── command │ ├── CommandReload.java │ ├── CommandVersion.java │ └── clan │ │ ├── CommandClanUntrustRank.java │ │ ├── CommandClanTrustRank.java │ │ └── CommandClanClaim.java │ ├── context │ └── ContextGroups.java │ ├── permission │ └── GDHooksPermissions.java │ ├── util │ ├── HooksUtil.java │ └── LegacyHexSerializer.java │ ├── event │ ├── GDTrustClaimEvent.java │ ├── GDClanTrustClaimEvent.java │ └── GDClaimEvent.java │ ├── listener │ └── GDShopEventListener.java │ └── GDHooksRelocator.java ├── common └── loader-utils │ ├── build.gradle │ └── src │ └── main │ └── java │ └── com │ └── griefdefender │ └── hooks │ └── loader │ ├── LoaderBootstrap.java │ └── LoadingException.java ├── .gitignore ├── LICENSE └── gradlew.bat /.gitmodules: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bloodmc/GDHooks/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'gdhooks' 2 | include "bukkit" 3 | include "bukkit:loader" 4 | include "common:loader-utils" -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | name=GDHooks 2 | group=com.griefdefender.hooks 3 | url=https://github.com/bloodmc/GDHooks 4 | version=0.8-DEV 5 | 6 | adapterVersion=1.19.0-20231117.010947-10 7 | bukkitVersion=1.16.4-R0.1-SNAPSHOT 8 | spigotVersion=1.16.4-R0.1-SNAPSHOT 9 | 10 | org.gradle.jvmargs=-Xmx3G -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: GDHooks 2 | main: com.griefdefender.hooks.loader.BukkitLoaderPlugin 3 | depend: [GriefDefender] 4 | softdepend: [BlueMap, BossShopPro, ChestShop, CustomItems, dynmap, DynamicShop, Guilds, InsaneShops, mcMMO, MyPet, MMOItems, MythicMobs, Nova, Parties, QuickShop, RevoltCrates, Shop, ShopChest, SimpleClans, Slabbo, squaremap, Towny, TradeShop, UltimateClans, UltimateShops] 5 | load: POSTWORLD 6 | version: '0.8-DEV' 7 | api-version: 1.13 8 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/category/ClanCategory.java: -------------------------------------------------------------------------------- 1 | package com.griefdefender.hooks.config.category; 2 | 3 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 4 | import org.spongepowered.configurate.objectmapping.meta.Comment; 5 | import org.spongepowered.configurate.objectmapping.meta.Setting; 6 | 7 | @ConfigSerializable 8 | public class ClanCategory extends ConfigCategory { 9 | 10 | @Setting(value = "clan-require-town") 11 | @Comment(value = "If true, requires a town to be owned in order to create a clan.") 12 | public boolean clanRequireTown = false; 13 | } 14 | -------------------------------------------------------------------------------- /common/loader-utils/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { 4 | url = 'https://plugins.gradle.org/m2/' 5 | } 6 | gradlePluginPortal() 7 | } 8 | 9 | dependencies { 10 | classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0' 11 | } 12 | } 13 | 14 | plugins { 15 | id 'com.github.johnrengelman.shadow' version '7.0.0' 16 | id 'java' 17 | id 'maven-publish' 18 | } 19 | 20 | repositories { 21 | maven { url 'https://papermc.io/repo/repository/maven-public/' } 22 | } 23 | 24 | dependencies { 25 | 26 | } 27 | 28 | tasks.assemble { 29 | dependsOn(tasks.shadowJar) 30 | } -------------------------------------------------------------------------------- /.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 | libs 13 | out 14 | run 15 | target 16 | *.com 17 | *.class 18 | *.dll 19 | *.exe 20 | *.o 21 | *.so 22 | 23 | # Databases # 24 | ############# 25 | *.db 26 | *.sql 27 | *.sqlite 28 | 29 | # Packages # 30 | ############ 31 | *.7z 32 | *.dmg 33 | *.gz 34 | *.iso 35 | *.rar 36 | *.tar 37 | *.zip 38 | 39 | # Repository # 40 | ############## 41 | .git 42 | 43 | # Logging # 44 | ########### 45 | /logs 46 | *.log 47 | 48 | # Misc # 49 | ######## 50 | *.bak 51 | 52 | # System # 53 | ########## 54 | .DS_Store 55 | ehthumbs.db 56 | Thumbs.db 57 | 58 | # Project # 59 | ########### 60 | .classpath 61 | .externalToolBuilders 62 | .gradle 63 | .idea 64 | .project 65 | .settings 66 | .checkstyle 67 | .factorypath 68 | run 69 | ./eclipse 70 | nbproject 71 | atlassian-ide-plugin.xml 72 | build.xml 73 | nb-configuration.xml 74 | *.iml 75 | *.ipr 76 | *.iws 77 | /.apt_generated/ 78 | *.launch 79 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bukkit/loader/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { 4 | url = 'https://plugins.gradle.org/m2/' 5 | } 6 | gradlePluginPortal() 7 | } 8 | 9 | dependencies { 10 | classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0' 11 | } 12 | } 13 | 14 | plugins { 15 | id 'com.github.johnrengelman.shadow' 16 | id 'java' 17 | id 'maven-publish' 18 | } 19 | 20 | sourceCompatibility = '1.8' 21 | targetCompatibility = '1.8' 22 | 23 | repositories { 24 | maven { 25 | name = 'aikar' 26 | url = 'https://repo.aikar.co/content/groups/aikar' 27 | } 28 | maven { 29 | name = 'spigot' 30 | url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots' 31 | } 32 | } 33 | 34 | dependencies { 35 | compileOnly "io.leangen.geantyref:geantyref:1.3.11" 36 | compileOnly "org.bukkit:bukkit:$spigotVersion" 37 | implementation project (':common:loader-utils') 38 | } 39 | 40 | 41 | shadowJar { 42 | archiveName = "gdhooks-bukkit-${version}.jar" 43 | 44 | from { 45 | project(':bukkit').tasks.shadowJar.archiveFile 46 | } 47 | } 48 | 49 | artifacts { 50 | archives shadowJar 51 | } -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) SpongePowered 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 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/simpleclans/CreateClaimBukkitEvent.java: -------------------------------------------------------------------------------- 1 | package com.griefdefender.hooks.provider.clan.simpleclans; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.event.Cancellable; 5 | import org.bukkit.event.Event; 6 | import org.bukkit.event.HandlerList; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | import com.griefdefender.api.claim.Claim; 10 | 11 | public class CreateClaimBukkitEvent extends Event implements Cancellable { 12 | 13 | public static final HandlerList handlers = new HandlerList(); 14 | private boolean cancelled = false; 15 | private Claim claim; 16 | private Player player; 17 | 18 | public CreateClaimBukkitEvent(Claim claim, Player creator) { 19 | this.claim = claim; 20 | this.player = creator; 21 | } 22 | 23 | @Override 24 | public boolean isCancelled() { 25 | return cancelled; 26 | } 27 | 28 | @Override 29 | public void setCancelled(boolean cancel) { 30 | this.cancelled = cancel; 31 | } 32 | 33 | public Player getCreator() { 34 | return this.player; 35 | } 36 | 37 | public Claim getClaim() { 38 | return this.claim; 39 | } 40 | 41 | @Override 42 | public @NotNull HandlerList getHandlers() { 43 | return handlers; 44 | } 45 | 46 | public static HandlerList getHandlerList() { 47 | return handlers; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/GDShopProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Location; 28 | 29 | public interface GDShopProvider { 30 | 31 | boolean isLocationShop(Location location); 32 | } 33 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/category/ConfigCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config.category; 26 | 27 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 28 | 29 | @ConfigSerializable 30 | public abstract class ConfigCategory { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/GDHooksAttributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks; 26 | 27 | import com.griefdefender.api.claim.ClaimAttribute; 28 | 29 | public class GDHooksAttributes { 30 | 31 | public static final ClaimAttribute ATTRIBUTE_CLAN = ClaimAttribute.builder().name("clan").id("gdhooks:clan").build(); 32 | } 33 | -------------------------------------------------------------------------------- /common/loader-utils/src/main/java/com/griefdefender/hooks/loader/LoaderBootstrap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of LuckPerms, licensed under the MIT License. 3 | * 4 | * Copyright (c) lucko (Luck) 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 all 15 | * 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 THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package com.griefdefender.hooks.loader; 27 | 28 | /** 29 | * Minimal bootstrap plugin, called by the loader plugin. 30 | */ 31 | public interface LoaderBootstrap { 32 | 33 | void onLoad(); 34 | 35 | void onEnable(); 36 | 37 | void onDisable(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/ShopProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Location; 28 | 29 | import com.snowgears.shop.Shop; 30 | 31 | public class ShopProvider implements GDShopProvider { 32 | 33 | @Override 34 | public boolean isLocationShop(Location location) { 35 | return Shop.getPlugin().getShopHandler().getShop(location) != null; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/QuickShopProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Location; 28 | import org.maxgamer.quickshop.QuickShop; 29 | 30 | public class QuickShopProvider implements GDShopProvider { 31 | 32 | @Override 33 | public boolean isLocationShop(Location location) { 34 | return QuickShop.getInstance().getShopManager().getShop(location) != null; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/plugin/ClassPathAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of LuckPerms, licensed under the MIT License. 3 | * 4 | * Copyright (c) lucko (Luck) 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 all 15 | * 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 THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package com.griefdefender.hooks.plugin; 27 | 28 | import java.nio.file.Path; 29 | 30 | /** 31 | * Interface which allows access to add URLs to the plugin classpath at runtime. 32 | */ 33 | public interface ClassPathAppender extends AutoCloseable { 34 | 35 | void addJarToClasspath(Path file); 36 | 37 | @Override 38 | default void close() { 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/TradeShopProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Location; 28 | import org.shanerx.tradeshop.enumys.ShopType; 29 | 30 | public class TradeShopProvider implements GDShopProvider { 31 | 32 | public TradeShopProvider() { 33 | } 34 | 35 | @Override 36 | public boolean isLocationShop(Location location) { 37 | return ShopType.isShop(location.getBlock()); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/SlabboProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Location; 28 | 29 | import xyz.mackan.Slabbo.manager.ShopManager; 30 | 31 | public class SlabboProvider implements GDShopProvider { 32 | 33 | @Override 34 | public boolean isLocationShop(Location location) { 35 | final String clickedLocation = ShopManager.locationToString(location); 36 | return ShopManager.shops.get(clickedLocation) != null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/loader-utils/src/main/java/com/griefdefender/hooks/loader/LoadingException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of LuckPerms, licensed under the MIT License. 3 | * 4 | * Copyright (c) lucko (Luck) 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 all 15 | * 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 THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package com.griefdefender.hooks.loader; 27 | 28 | /** 29 | * Runtime exception used if there is a problem during loading 30 | */ 31 | public class LoadingException extends RuntimeException { 32 | 33 | public LoadingException(String message) { 34 | super(message); 35 | } 36 | 37 | public LoadingException(String message, Throwable cause) { 38 | super(message, cause); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/ShopChestProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Location; 28 | 29 | import de.epiceric.shopchest.ShopChest; 30 | 31 | public class ShopChestProvider implements GDShopProvider { 32 | 33 | private final ShopChest plugin; 34 | 35 | public ShopChestProvider() { 36 | this.plugin = ShopChest.getInstance(); 37 | } 38 | 39 | @Override 40 | public boolean isLocationShop(Location location) { 41 | return this.plugin.getShopUtils().isShop(location); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/RevoltCratesProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider; 26 | 27 | import org.bukkit.inventory.ItemStack; 28 | 29 | import com.griefdefender.api.GriefDefender; 30 | 31 | public class RevoltCratesProvider { 32 | 33 | public RevoltCratesProvider() { 34 | } 35 | 36 | public String getItemId(ItemStack itemstack) { 37 | final String id = GriefDefender.getNBTUtil().getItemNBTValue(itemstack, "RevoltCratesKey"); 38 | if (id != null) { 39 | return "revoltcrates:" + id; 40 | } 41 | 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/CustomItemsProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider; 26 | 27 | import org.bukkit.inventory.ItemStack; 28 | 29 | import com.griefdefender.api.GriefDefender; 30 | 31 | public class CustomItemsProvider { 32 | 33 | public CustomItemsProvider() { 34 | } 35 | 36 | public String getItemId(ItemStack itemstack) { 37 | final String id = GriefDefender.getNBTUtil().getItemNBTValue(itemstack, "com.jojodmo.customitems.itemID"); 38 | if (id != null) { 39 | return "customitems:" + id; 40 | } 41 | 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/DynamicShopProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Location; 28 | 29 | import me.sat7.dynamicshop.DynamicShop; 30 | 31 | public class DynamicShopProvider implements GDShopProvider { 32 | 33 | private final DynamicShop plugin; 34 | 35 | public DynamicShopProvider() { 36 | this.plugin = DynamicShop.plugin; 37 | } 38 | 39 | @Override 40 | public boolean isLocationShop(Location location) { 41 | final String signId = location.getBlockX() + "_" + location.getBlockY() + "_" + location.getBlockZ(); 42 | return DynamicShop.ccSign.get().contains(signId); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/UltimateShopsProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Bukkit; 28 | import org.bukkit.Location; 29 | 30 | import thirtyvirus.ultimateshops.UltimateShops; 31 | import thirtyvirus.ultimateshops.helpers.Utilities; 32 | 33 | public class UltimateShopsProvider implements GDShopProvider { 34 | 35 | private final UltimateShops plugin; 36 | 37 | public UltimateShopsProvider() { 38 | this.plugin = (UltimateShops) Bukkit.getPluginManager().getPlugin("UltimateShops"); 39 | } 40 | 41 | @Override 42 | public boolean isLocationShop(Location location) { 43 | return this.plugin.getShops().get(Utilities.toLocString(location)) != null; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/uclans/GDRank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.uclans; 26 | 27 | import java.util.Collections; 28 | import java.util.Set; 29 | 30 | import com.griefdefender.api.clan.Rank; 31 | 32 | public class GDRank implements Rank { 33 | 34 | private final String pluginRank; 35 | 36 | public GDRank(String rank) { 37 | this.pluginRank = rank; 38 | } 39 | 40 | @Override 41 | public String getName() { 42 | return this.pluginRank; 43 | } 44 | 45 | @Override 46 | public String getDisplayName() { 47 | return this.pluginRank; 48 | } 49 | 50 | @Override 51 | public Set getPermissions() { 52 | return Collections.emptySet(); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/category/MessageCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config.category; 26 | 27 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 28 | import org.spongepowered.configurate.objectmapping.meta.Comment; 29 | import org.spongepowered.configurate.objectmapping.meta.Setting; 30 | 31 | @ConfigSerializable 32 | public class MessageCategory extends ConfigCategory { 33 | 34 | @Setting(value = "locale") 35 | @Comment(value = "Set the locale to use for GD messages. (Default: en_US)\n" + 36 | "Available languages: de_DE, en_US, es_ES, fr_FR, it_IT, pl_PL, ru_RU, zh_CN, zh_HK. The data is stored under assets in jar.\n" + 37 | "Note: The language code must be lowercase and the country code must be uppercase.") 38 | public String locale = "en_US"; 39 | } 40 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/simpleclans/GDRank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.simpleclans; 26 | 27 | import java.util.Set; 28 | 29 | import com.griefdefender.api.clan.Rank; 30 | 31 | public class GDRank implements Rank { 32 | 33 | private final net.sacredlabyrinth.phaed.simpleclans.Rank pluginRank; 34 | 35 | public GDRank(net.sacredlabyrinth.phaed.simpleclans.Rank rank) { 36 | this.pluginRank = rank; 37 | } 38 | 39 | @Override 40 | public String getName() { 41 | return this.pluginRank.getName(); 42 | } 43 | 44 | @Override 45 | public String getDisplayName() { 46 | return this.pluginRank.getDisplayName(); 47 | } 48 | 49 | @Override 50 | public Set getPermissions() { 51 | return this.pluginRank.getPermissions(); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/towny/GDRank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.towny; 26 | 27 | import java.util.Collections; 28 | import java.util.HashSet; 29 | import java.util.Set; 30 | 31 | import com.griefdefender.api.clan.Rank; 32 | import com.palmergames.bukkit.towny.permissions.TownyPerms; 33 | 34 | public class GDRank implements Rank { 35 | 36 | private final String pluginRank; 37 | 38 | public GDRank(String rank) { 39 | this.pluginRank = rank.toLowerCase(); 40 | } 41 | 42 | @Override 43 | public String getName() { 44 | return this.pluginRank; 45 | } 46 | 47 | @Override 48 | public String getDisplayName() { 49 | return this.pluginRank; 50 | } 51 | 52 | @Override 53 | public Set getPermissions() { 54 | return Collections.unmodifiableSet(new HashSet<>(TownyPerms.getTownRank(this.pluginRank))); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/mcmmo/McMMOPlayerAbilityData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.mcmmo; 26 | 27 | import java.util.Set; 28 | import java.util.UUID; 29 | 30 | import com.gmail.nossr50.datatypes.skills.PrimarySkillType; 31 | import com.gmail.nossr50.datatypes.skills.SuperAbilityType; 32 | import com.griefdefender.api.permission.Context; 33 | 34 | public class McMMOPlayerAbilityData { 35 | 36 | public UUID uuid; 37 | public PrimarySkillType skillType; 38 | public int skillLevel; 39 | public SuperAbilityType ability; 40 | public Set contexts; 41 | 42 | public McMMOPlayerAbilityData(UUID uuid, SuperAbilityType ability, PrimarySkillType skillType, int skillLevel, Set contexts) { 43 | this.uuid = uuid; 44 | this.ability = ability; 45 | this.skillType = skillType; 46 | this.skillLevel = skillLevel; 47 | this.contexts = contexts; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/InsaneShopsProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import java.lang.reflect.Field; 28 | 29 | import org.bukkit.Location; 30 | 31 | import me.TechsCode.InsaneShops.InsaneShops; 32 | import me.TechsCode.InsaneShops.base.reflection.titleAndActionbar.ActionBar; 33 | 34 | public class InsaneShopsProvider implements GDShopProvider { 35 | 36 | private InsaneShops plugin; 37 | 38 | public InsaneShopsProvider() { 39 | try { 40 | Field field = ActionBar.class.getDeclaredField("plugin"); 41 | field.setAccessible(true); 42 | this.plugin = (InsaneShops) field.get(null); 43 | } catch (Throwable t) { 44 | t.printStackTrace(); 45 | } 46 | } 47 | 48 | @Override 49 | public boolean isLocationShop(Location location) { 50 | return this.plugin.getShops().location(location).isPresent(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/FurnitureLibProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider; 26 | 27 | import org.bukkit.Bukkit; 28 | import org.bukkit.event.EventHandler; 29 | import org.bukkit.event.EventPriority; 30 | import org.bukkit.event.Listener; 31 | import org.bukkit.inventory.ItemStack; 32 | 33 | import com.griefdefender.api.GriefDefender; 34 | import com.griefdefender.hooks.GDHooksBootstrap; 35 | 36 | import de.Ste3et_C0st.FurnitureLib.Events.FurnitureItemEvent; 37 | 38 | public class FurnitureLibProvider implements Listener { 39 | 40 | public FurnitureLibProvider() { 41 | Bukkit.getPluginManager().registerEvents(this, GDHooksBootstrap.getInstance().getLoader()); 42 | } 43 | 44 | public String getItemId(ItemStack itemstack) { 45 | final String id = GriefDefender.getNBTUtil().getItemNBTValue(itemstack, "PublicBukkitValues", "furniturelib:model"); 46 | if (id != null) { 47 | return "furniturelib:" + id.toLowerCase(); 48 | } 49 | 50 | return null; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/java/com/griefdefender/hooks/loader/BukkitLoaderPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of LuckPerms, licensed under the MIT License. 3 | * 4 | * Copyright (c) lucko (Luck) 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 all 15 | * 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 THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package com.griefdefender.hooks.loader; 27 | 28 | import org.bukkit.plugin.java.JavaPlugin; 29 | 30 | public class BukkitLoaderPlugin extends JavaPlugin { 31 | private static final String JAR_NAME = "gdhooks-bukkit.jarinjar"; 32 | private static final String BOOTSTRAP_CLASS = "com.griefdefender.hooks.GDHooksBootstrap"; 33 | 34 | private final LoaderBootstrap plugin; 35 | 36 | public BukkitLoaderPlugin() { 37 | JarInJarClassLoader loader = new JarInJarClassLoader(getClass().getClassLoader(), JAR_NAME); 38 | this.plugin = loader.instantiatePlugin(BOOTSTRAP_CLASS, JavaPlugin.class, this); 39 | } 40 | 41 | @Override 42 | public void onLoad() { 43 | this.plugin.onLoad(); 44 | } 45 | 46 | @Override 47 | public void onEnable() { 48 | this.plugin.onEnable(); 49 | } 50 | 51 | @Override 52 | public void onDisable() { 53 | this.plugin.onDisable(); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/parties/GDRank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.parties; 26 | 27 | import com.alessiodp.parties.api.interfaces.PartyRank; 28 | import com.griefdefender.api.clan.Rank; 29 | 30 | import java.util.HashSet; 31 | import java.util.Set; 32 | 33 | public class GDRank implements Rank { 34 | 35 | private final PartyRank pluginRank; 36 | private final Set permissions = new HashSet<>(); 37 | 38 | public GDRank(PartyRank rank) { 39 | this.pluginRank = rank; 40 | for (String rankPerm : this.pluginRank.getPermissions()) { 41 | permissions.add(rankPerm.toLowerCase()); 42 | } 43 | } 44 | 45 | @Override 46 | public String getName() { 47 | return this.pluginRank.getConfigName(); 48 | } 49 | 50 | @Override 51 | public String getDisplayName() { 52 | return this.pluginRank.getName(); 53 | } 54 | 55 | @Override 56 | public Set getPermissions() { 57 | return this.permissions; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/command/CommandReload.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.command; 26 | 27 | import co.aikar.commands.BaseCommand; 28 | import co.aikar.commands.annotation.CommandAlias; 29 | import co.aikar.commands.annotation.CommandPermission; 30 | import co.aikar.commands.annotation.Description; 31 | import co.aikar.commands.annotation.Subcommand; 32 | 33 | import com.griefdefender.api.GriefDefender; 34 | import com.griefdefender.hooks.GDHooks; 35 | import com.griefdefender.hooks.config.MessageConfig; 36 | import com.griefdefender.hooks.permission.GDHooksPermissions; 37 | 38 | import org.bukkit.command.CommandSender; 39 | 40 | @CommandAlias("gdhooks") 41 | @CommandPermission(GDHooksPermissions.COMMAND_RELOAD) 42 | public class CommandReload extends BaseCommand { 43 | 44 | @CommandAlias("gdhooksreload") 45 | @Description("%reload") 46 | @Subcommand("reload") 47 | public void execute(CommandSender src) { 48 | GDHooks.getInstance().reload(); 49 | GriefDefender.getAudienceProvider().getSender(src).sendMessage(MessageConfig.MESSAGE_DATA.getMessage(MessageConfig.PLUGIN_RELOAD)); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/guilds/GDRank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.guilds; 26 | 27 | import java.util.HashSet; 28 | import java.util.Set; 29 | 30 | import com.griefdefender.api.clan.Rank; 31 | 32 | import me.glaremasters.guilds.guild.GuildRole; 33 | import me.glaremasters.guilds.guild.GuildRolePerm; 34 | 35 | public class GDRank implements Rank { 36 | 37 | private final GuildRole pluginRank; 38 | private final Set permissions = new HashSet<>(); 39 | 40 | public GDRank(GuildRole rank) { 41 | this.pluginRank = rank; 42 | final Set perms = this.pluginRank.getPerms(); 43 | for (GuildRolePerm rolePerm : perms) { 44 | permissions.add(rolePerm.name().toLowerCase()); 45 | } 46 | } 47 | 48 | @Override 49 | public String getName() { 50 | return this.pluginRank.getName(); 51 | } 52 | 53 | @Override 54 | public String getDisplayName() { 55 | return this.pluginRank.getName(); 56 | } 57 | 58 | @Override 59 | public Set getPermissions() { 60 | return this.permissions; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/context/ContextGroups.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.context; 26 | 27 | import com.griefdefender.api.permission.Context; 28 | import com.griefdefender.api.permission.ContextKeys; 29 | 30 | public class ContextGroups { 31 | 32 | public static final Context SOURCE_ANY = new Context(ContextKeys.SOURCE, "#any"); 33 | public static final Context TARGET_ANY = new Context(ContextKeys.TARGET, "#any"); 34 | public static final Context SOURCE_MONSTER = new Context(ContextKeys.SOURCE, "#monster"); 35 | public static final Context TARGET_MONSTER = new Context(ContextKeys.TARGET, "#monster"); 36 | // Custom mod groups 37 | public static final Context SOURCE_MYPET = new Context(ContextKeys.SOURCE, "#mypet:any"); 38 | public static final Context TARGET_MYPET = new Context(ContextKeys.TARGET, "#mypet:any"); 39 | public static final Context SOURCE_MYTHICMOBS = new Context(ContextKeys.SOURCE, "#mythicmobs:any"); 40 | public static final Context TARGET_MYTHICMOBS = new Context(ContextKeys.TARGET, "#mythicmobs:any"); 41 | public static final Context TARGET_ELITEMOBS = new Context(ContextKeys.TARGET, "#elitemobs:any"); 42 | } 43 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/GDClanHome.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan; 26 | 27 | import java.util.UUID; 28 | 29 | import org.bukkit.Location; 30 | 31 | import com.griefdefender.api.clan.ClanHome; 32 | import com.griefdefender.lib.flowpowered.math.vector.Vector3i; 33 | 34 | public class GDClanHome implements ClanHome { 35 | 36 | private final String name; 37 | private final Location location; 38 | private final Vector3i pos; 39 | 40 | public GDClanHome(String name, Location location) { 41 | this.name = name; 42 | this.location = location; 43 | this.pos = new Vector3i(location.getBlockX(), location.getBlockY(), location.getBlockZ()); 44 | } 45 | 46 | @Override 47 | public String getName() { 48 | return this.name; 49 | } 50 | 51 | @Override 52 | public UUID getHomeWorldUniqueId() { 53 | return this.location.getWorld().getUID(); 54 | } 55 | 56 | @Override 57 | public Vector3i getHomePos() { 58 | return this.pos; 59 | } 60 | 61 | @Override 62 | public Object getLocation() { 63 | return this.location; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/ItemsAdderProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider; 26 | 27 | import org.bukkit.block.Block; 28 | import org.bukkit.inventory.ItemStack; 29 | 30 | import dev.lone.itemsadder.api.CustomBlock; 31 | import dev.lone.itemsadder.api.CustomStack; 32 | 33 | public class ItemsAdderProvider { 34 | 35 | public ItemsAdderProvider() { 36 | } 37 | 38 | public String getItemId(ItemStack itemstack) { 39 | final CustomStack customStack = CustomStack.byItemStack(itemstack); 40 | if (customStack == null) { 41 | return null; 42 | } 43 | 44 | String name = customStack.getDisplayName(); 45 | name = name.replaceAll(" ", "\\_"); 46 | name = name.replaceAll("[^A-Za-z0-9\\_]", ""); 47 | return "itemsadder:" + name.toLowerCase(); 48 | } 49 | 50 | public String getBlockId(Block block) { 51 | final CustomBlock customBlock = CustomBlock.byAlreadyPlaced(block); 52 | if (customBlock == null) { 53 | return null; 54 | } 55 | 56 | String name = customBlock.getDisplayName(); 57 | name = name.replaceAll(" ", "\\_"); 58 | name = name.replaceAll("[^A-Za-z0-9\\_]", ""); 59 | return "itemsadder:" + name.toLowerCase(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/zh_HK.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | trust-clan="給予一個權限組的人士使用您的這個領地.\n存取權限身份: 允許活動所有方塊,除了容器.\n容器使用權限身份: 允許活動所有方塊,包括容器.\n建築者: 允許所有以上的權限,包括放置及破壞方塊的權限.\n管理者: 允許所有以上的權限,包括更改領地內設定." 4 | trust-clan-all="給予一個權限組的人士使用您所有的領地.\n存取權限身份: 允許活動所有方塊,除了容器.\n容器使用權限身份: 允許活動所有方塊,包括容器.\n建築者: 允許所有以上的權限,包括放置及破壞方塊的權限.\n管理者: 允許所有以上的權限,包括更改領地內設定." 5 | untrust-clan="移除一個群組使用您這個領地的權限." 6 | untrust-clan-all="移除一個群組使用您所有領地的權限." 7 | version="顯示插件版本." 8 | } 9 | messages { 10 | claim-disabled-world="&c這個世界關閉了領地保護系統." 11 | command-invalid="&c你並未輸入有效的指令." 12 | command-invalid-claim="&c這個指令不能用在 {type}&c 的領地." 13 | command-invalid-group="&c身份組 &6{group}&c 無效." 14 | command-invalid-input="&c你輸入了無效指令 '{input}&c'." 15 | command-invalid-player="&c玩家名稱 &6{player}&c 無效." 16 | command-invalid-player-group="&c並非有效的玩家或者權限組別." 17 | command-invalid-type="&c你輸入了無效種類 {type}&c" 18 | command-world-not-found="&c找不到世界 '&6{world}&c' ." 19 | permission-access="&c你沒有 &6{player}&c 給予的權限去使用這個東西." 20 | permission-build="&c你沒有 &6{player}&c 給予的權限去建築." 21 | permission-build-near-claim="&c你沒有 &6{player}&c 給予的權限去在領地附近建築." 22 | permission-command-trust="&c你沒有權限去使用這種類的trust(信任)權限身份." 23 | permission-edit-claim="&c你沒有權限去編輯這個領地." 24 | permission-interact-block="&c你沒有 &6{player} &c給予的權限去與 &d{block} &c方塊互動." 25 | permission-interact-entity="&c你沒有 &6{player} &c給予的權限去與 &d{entity} &c實體互動." 26 | permission-interact-item="&c你沒有 &6{player} &c給予的權限去與 &d{item} &c道具互動." 27 | permission-interact-item-block="&c您沒有權限使用 &d{item}&c 道具在 &b{block} &c方塊上." 28 | permission-interact-item-entity="&c您沒有權限使用 &d{item}&c 道具在 &b{entity} &c實體上." 29 | permission-inventory-open="&c你沒有 &6{player} &c給予的權限去打開 &d{block}&c." 30 | permission-item-drop="&c你沒有 &6{player} &c給予的權限去掉落 &d{item} &c道具在此領地." 31 | permission-item-use="&c您不可以使用道具 &d{item} &c在此領地." 32 | permission-option-use="&c你沒有權限去使用這個選項." 33 | permission-override-deny="&c你嘗試做的這個行為已經被管理員的複寫設定禁止." 34 | plugin-event-cancel="&c一個插件已經取消了這個行動." 35 | plugin-reload="&aGDHooks 已經重新讀取." 36 | trust-already-has="&c{target} 已經擁有 {type}&c 權限." 37 | trust-grant="&a給予了 &6{target}&a {type}&a 權限在這個領地." 38 | trust-invalid="&c您輸入了一個無效的領地信任權限身份.\n允許的種類有 : 訪問者, 建築者, 容器使用, 以及 管理者." 39 | trust-no-claims="&c你並沒有領地可以給予信任權限身份." 40 | trust-plugin-cancel="&c您給予信用權限給 {target}&c. 一個插件防止了這個行為." 41 | trust-self="&c你無法給予自己信任權限." 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/permission/GDHooksPermissions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.permission; 26 | 27 | public class GDHooksPermissions { 28 | 29 | public static final String COMMAND_RELOAD = "gdhooks.admin.command.reload"; 30 | public static final String COMMAND_VERSION = "gdhooks.user.command.version"; 31 | 32 | public static final String COMMAND_CLAN_CLAIM = "gdhooks.user.clan.command.claim"; 33 | public static final String COMMAND_TRUST_CLAN = "gdhooks.user.clan.command.trust"; 34 | public static final String COMMAND_TRUST_RANK = "gdhooks.user.clan.command.trustrank"; 35 | public static final String COMMAND_TRUSTALL_CLAN = "gdhooks.user.clan.command.trustall"; 36 | public static final String COMMAND_UNTRUST_CLAN = "gdhooks.user.clan.command.untrust"; 37 | public static final String COMMAND_UNTRUST_RANK = "gdhooks.user.clan.command.untrustrank"; 38 | public static final String COMMAND_UNTRUSTALL_CLAN = "gdhooks.user.clan.command.untrustall"; 39 | 40 | public static final String COMMAND_TRUSTALL_CLAN_ADMIN = "gdhooks.admin.clan.command.trustalladmin"; 41 | public static final String COMMAND_UNTRUSTALL_CLAN_ADMIN = "gdhooks.admin.clan.command.untrustalladmin"; 42 | 43 | public static final String PROVIDER_MCMMO_AUTO_PARTY_TRUST = "gdhooks.user.mcmmo.auto-party-trust"; 44 | } 45 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/ChestShopProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import org.bukkit.Location; 28 | import org.bukkit.block.Block; 29 | import org.bukkit.block.BlockState; 30 | import org.bukkit.block.Sign; 31 | 32 | import com.Acrobot.ChestShop.ChestShop; 33 | import com.Acrobot.ChestShop.Signs.ChestShopSign; 34 | 35 | public class ChestShopProvider implements GDShopProvider { 36 | 37 | private final ChestShop plugin; 38 | 39 | public ChestShopProvider() { 40 | this.plugin = ChestShop.getPlugin(); 41 | } 42 | 43 | @Override 44 | public boolean isLocationShop(Location location) { 45 | final Block block = location.getBlock(); 46 | if (isShopSign(block)) { 47 | return true; 48 | } 49 | return ChestShopSign.isShopBlock(block); 50 | } 51 | 52 | private boolean isShopSign(Block block) { 53 | if (block == null) { 54 | return false; 55 | } 56 | 57 | final BlockState state = block.getState(); 58 | if (!(state instanceof Sign)) { 59 | return false; 60 | } 61 | 62 | final String signData = (ChestShopSign.getItem((Sign) state)); 63 | if (signData != null && !signData.isEmpty()) { 64 | return true; 65 | } 66 | return false; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/plugin/JarInJarClassPathAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of LuckPerms, licensed under the MIT License. 3 | * 4 | * Copyright (c) lucko (Luck) 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 all 15 | * 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 THE 23 | * SOFTWARE. 24 | */ 25 | 26 | package com.griefdefender.hooks.plugin; 27 | 28 | import java.io.IOException; 29 | import java.net.MalformedURLException; 30 | import java.nio.file.Path; 31 | 32 | import com.griefdefender.hooks.loader.JarInJarClassLoader; 33 | 34 | public class JarInJarClassPathAppender implements ClassPathAppender { 35 | private final JarInJarClassLoader classLoader; 36 | 37 | public JarInJarClassPathAppender(ClassLoader classLoader) { 38 | if (!(classLoader instanceof JarInJarClassLoader)) { 39 | throw new IllegalArgumentException("Loader is not a JarInJarClassLoader: " + classLoader.getClass().getName()); 40 | } 41 | this.classLoader = (JarInJarClassLoader) classLoader; 42 | } 43 | 44 | @Override 45 | public void addJarToClasspath(Path file) { 46 | try { 47 | this.classLoader.addJarToClasspath(file.toUri().toURL()); 48 | } catch (MalformedURLException e) { 49 | throw new RuntimeException(e); 50 | } 51 | } 52 | 53 | @Override 54 | public void close() { 55 | this.classLoader.deleteJarResource(); 56 | try { 57 | this.classLoader.close(); 58 | } catch (IOException e) { 59 | e.printStackTrace(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/zh_CN.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | trust-clan="在您目前所处的领地上授予单个权限组所有成员权限。\n非容器交互身份: 允许与 除容器之外 的所有方块进行交互。\n容器交互身份: 允许与 包括容器在内 的所有方块进行交互。\n领地建筑师: 允许一切建立在 方块的放置与破坏 上的行为。\n领地管理者: 允许一切(包括领地标签管理)行为。" 4 | trust-clan-all="在您所有的领地上授予单个权限组所有成员权限。\n非容器交互身份: 允许与 除容器之外 的所有方块进行交互。\n容器交互身份: 允许与 包括容器在内 的所有方块进行交互。\n领地建筑师: 允许一切建立在 方块的放置与破坏 上的行为。\n领地管理者: 允许一切(包括领地标签管理)行为。" 5 | untrust-clan="移除一个LP权限组在您目前所处领地上的权限。" 6 | untrust-clan-all="移除一个LP权限组在您所有领地上的权限。" 7 | version="显示 GDHooks 的版本信息。" 8 | } 9 | messages { 10 | claim-disabled-world="&c领地在这个世界被禁用。" 11 | command-invalid="&c没有有效的命令被输入。" 12 | command-invalid-claim="&c这个命令无法在类型为 {type}&c 的领地使用。" 13 | command-invalid-group="&c权限组 &6{group}&c 不是有效参数。" 14 | command-invalid-input="&c无效的命令键入 '{input}&c'。" 15 | command-invalid-player="&c玩家 &6{player}&c 不是有效的。" 16 | command-invalid-player-group="&c不是一个有效的权限组和玩家。" 17 | command-invalid-type="&c无效类型 {type}&c 被指定。" 18 | command-world-not-found="&c世界 '&6{world}&c' 无法被找到。" 19 | permission-access="&c您没有来自 &6{player}&c 的权限来那么做。" 20 | permission-build="&c您没有来自 &6{player}&c 的权限来建筑。" 21 | permission-build-near-claim="&c您没有来自 &6{player}&c 的权限来在领地附近建筑。" 22 | permission-command-trust="&c您没有权限来使用此类型的信任预设。" 23 | permission-edit-claim="&c您没有权限来编辑这个领地。" 24 | permission-interact-block="&c您没有来自 &6{player} &c的权限来与方块 &d{block}&c 进行交互。" 25 | permission-interact-entity="&c您没有来自 &6{player}'s &c的权限來与实体 &d{entity}&c 进行交互。" 26 | permission-interact-item="&c您没有来自 &6{player} &c的权限來与物品 &d{item}&c 进行交互。" 27 | permission-interact-item-block="&c您没有权限将物品 &d{item}&c 用于方块 &b{block}&c。" 28 | permission-interact-item-entity="&c您没有权限将物品 &d{item}&c 用于实体 &b{entity}&c。" 29 | permission-inventory-open="&c您没有来自 &6{player}&c 的权限来打开方块 &d{block}&c 的界面。" 30 | permission-item-drop="&c您没有来自 &6{player}&c 的权限来在这个领地中丢弃物品 &d{item}&c 。" 31 | permission-item-use="&c您没有在这个领地中使用物品 &d{item}&c 的权限。" 32 | permission-option-use="&c您没有权限来使用这个选项配置。" 33 | permission-override-deny="&c您正在尝试的行为已被禁止于管理员提供的领地标签覆写。" 34 | plugin-event-cancel="&c另一个插件已取消该事件。" 35 | plugin-reload="&aGDHooks已重载。" 36 | trust-already-has="&c{target} 已经拥有 {type}&c 权限。" 37 | trust-grant="&a已给予 &6{target} &a在当前领地内的 &6{type}&a 信任权限。" 38 | trust-invalid="&c输入了无效的信任权限。\n有效的权限如下 : accessor(非容器交互身份),builder(领地建筑师),container(容器交互身份),以及 manager(领地管理组)。" 39 | trust-no-claims="&c您没有领地来添加信任权限。" 40 | trust-plugin-cancel="&c由于第三方插件的阻止,不能为 &6{target} &c添加信任权限。" 41 | trust-self="&c您不能为您自己添加信任权限。" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/util/HooksUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.util; 26 | 27 | import org.bukkit.Location; 28 | import org.bukkit.block.Block; 29 | import org.bukkit.block.BlockState; 30 | import org.bukkit.block.Sign; 31 | 32 | import com.griefdefender.api.claim.TrustType; 33 | import com.griefdefender.api.claim.TrustTypes; 34 | 35 | public class HooksUtil { 36 | 37 | public static Sign getSign(Location location) { 38 | if (location == null) { 39 | return null; 40 | } 41 | 42 | final Block block = location.getBlock(); 43 | final BlockState state = block.getState(); 44 | if (!(state instanceof Sign)) { 45 | return null; 46 | } 47 | 48 | return (Sign) state; 49 | } 50 | 51 | public static TrustType getTrustType(String type) { 52 | switch (type.toLowerCase()) { 53 | case "accessor" : 54 | return TrustTypes.ACCESSOR; 55 | case "resident" : 56 | return TrustTypes.RESIDENT; 57 | case "builder" : 58 | return TrustTypes.BUILDER; 59 | case "container" : 60 | return TrustTypes.CONTAINER; 61 | case "manager" : 62 | return TrustTypes.MANAGER; 63 | case "none" : 64 | return TrustTypes.NONE; 65 | default : 66 | return null; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/GDHooksConfigData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config; 26 | 27 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 28 | import org.spongepowered.configurate.objectmapping.meta.Comment; 29 | import org.spongepowered.configurate.objectmapping.meta.Setting; 30 | 31 | import com.griefdefender.hooks.config.category.BluemapCategory; 32 | import com.griefdefender.hooks.config.category.ClanCategory; 33 | import com.griefdefender.hooks.config.category.ConfigCategory; 34 | import com.griefdefender.hooks.config.category.DynmapCategory; 35 | import com.griefdefender.hooks.config.category.MessageCategory; 36 | import com.griefdefender.hooks.config.category.ProviderCategory; 37 | import com.griefdefender.hooks.config.category.SquaremapCategory; 38 | 39 | @ConfigSerializable 40 | public class GDHooksConfigData extends ConfigCategory { 41 | 42 | @Setting 43 | public BluemapCategory bluemap = new BluemapCategory(); 44 | 45 | @Setting 46 | public ClanCategory clan = new ClanCategory(); 47 | 48 | @Setting 49 | public DynmapCategory dynmap = new DynmapCategory(); 50 | 51 | @Setting 52 | public SquaremapCategory squaremap = new SquaremapCategory(); 53 | 54 | @Setting 55 | public MessageCategory message = new MessageCategory(); 56 | 57 | @Setting(value = "provider") 58 | @Comment(value = "Manages plugin providers that GDHooks plugs into for extended functionality.") 59 | public ProviderCategory providerCategory = new ProviderCategory(); 60 | 61 | public GDHooksConfigData() { 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/category/BluemapOwnerStyleCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config.category; 26 | 27 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 28 | import org.spongepowered.configurate.objectmapping.meta.Setting; 29 | 30 | import com.griefdefender.api.claim.ClaimType; 31 | import com.griefdefender.api.claim.ClaimTypes; 32 | 33 | @ConfigSerializable 34 | public class BluemapOwnerStyleCategory { 35 | 36 | @Setting("line-color") 37 | public String lineColor = "#FF0000"; 38 | 39 | @Setting("stroke-opacity") 40 | public float strokeOpacity = 0.8f; 41 | 42 | @Setting("fill-color") 43 | public String fillColor = "#FF0000"; 44 | 45 | @Setting("fill-opacity") 46 | public float fillOpacity = 0.35f; 47 | 48 | @Setting("label") 49 | public String label = "none"; 50 | 51 | public BluemapOwnerStyleCategory() { 52 | } 53 | 54 | public BluemapOwnerStyleCategory(ClaimType type) { 55 | if (type.equals(ClaimTypes.ADMIN)) { 56 | this.lineColor = "#FF0000"; 57 | this.fillColor = "#FF0000"; 58 | } else if (type.equals(ClaimTypes.BASIC)) { 59 | this.lineColor = "#FFFF00"; 60 | this.fillColor = "#FFFF00"; 61 | } else if (type.equals(ClaimTypes.TOWN)) { 62 | this.lineColor = "#00FF00"; 63 | this.fillColor = "#00FF00"; 64 | } else if (type.equals(ClaimTypes.SUBDIVISION)) { 65 | this.lineColor = "#FF9C00"; 66 | this.fillColor = "#FF9C00"; 67 | } else { 68 | this.lineColor = "#FF0000"; 69 | this.fillColor = "#FF0000"; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/shop/BossShopProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.shop; 26 | 27 | import java.util.HashMap; 28 | 29 | import org.black_ixx.bossshop.BossShop; 30 | import org.black_ixx.bossshop.core.BSShop; 31 | import org.bukkit.Bukkit; 32 | import org.bukkit.Location; 33 | import org.bukkit.block.Sign; 34 | 35 | import com.griefdefender.hooks.util.HooksUtil; 36 | 37 | public class BossShopProvider implements GDShopProvider { 38 | 39 | private BossShop plugin; 40 | 41 | public BossShopProvider() { 42 | this.plugin = (BossShop) Bukkit.getPluginManager().getPlugin("BossShopPro"); 43 | } 44 | 45 | @Override 46 | public boolean isLocationShop(Location location) { 47 | final Sign sign = HooksUtil.getSign(location); 48 | if (sign == null) { 49 | return false; 50 | } 51 | 52 | try { 53 | String line = sign.getLine(0); 54 | if (line == null || line == "") { 55 | return false; 56 | } 57 | 58 | line = line.toLowerCase(); 59 | final HashMap set = this.plugin.getClassManager().getShops().getShops(); 60 | 61 | for (Integer s : set.keySet()) { 62 | BSShop shop = set.get(s); 63 | String signtext = shop.getSignText(); 64 | if (signtext != null) { 65 | if (line.endsWith(signtext.toLowerCase())) { 66 | return true; 67 | } 68 | } 69 | } 70 | 71 | return false; 72 | } catch (Throwable t) { 73 | return false; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/event/GDTrustClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.event; 26 | 27 | import com.griefdefender.api.GriefDefender; 28 | import com.griefdefender.api.claim.Claim; 29 | import com.griefdefender.api.claim.TrustType; 30 | import com.griefdefender.api.event.TrustClaimEvent; 31 | 32 | import java.util.List; 33 | 34 | public class GDTrustClaimEvent extends GDClaimEvent implements TrustClaimEvent { 35 | 36 | private TrustType trustType; 37 | 38 | public GDTrustClaimEvent(Claim claim, TrustType trustType) { 39 | super(GriefDefender.getEventManager().getCauseStackManager().getCurrentCause().root(), claim); 40 | this.trustType = trustType; 41 | } 42 | 43 | public GDTrustClaimEvent(List claims, TrustType trustType) { 44 | super(GriefDefender.getEventManager().getCauseStackManager().getCurrentCause().root(), claims); 45 | this.trustType = trustType; 46 | } 47 | 48 | @Override 49 | public TrustType getTrustType() { 50 | return this.trustType; 51 | } 52 | 53 | public static class Add extends GDTrustClaimEvent implements TrustClaimEvent.Add { 54 | 55 | public Add(Claim claim, TrustType trustType) { 56 | super(claim, trustType); 57 | } 58 | 59 | public Add(List claims, TrustType trustType) { 60 | super(claims, trustType); 61 | } 62 | } 63 | 64 | public static class Remove extends GDTrustClaimEvent implements TrustClaimEvent.Remove { 65 | 66 | public Remove(Claim claim, TrustType trustType) { 67 | super(claim, trustType); 68 | } 69 | 70 | public Remove(List claims, TrustType trustType) { 71 | super(claims, trustType); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/category/DynmapOwnerStyleCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config.category; 26 | 27 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 28 | import org.spongepowered.configurate.objectmapping.meta.Setting; 29 | 30 | import com.griefdefender.api.claim.ClaimType; 31 | import com.griefdefender.api.claim.ClaimTypes; 32 | 33 | @ConfigSerializable 34 | public class DynmapOwnerStyleCategory { 35 | 36 | @Setting("stroke-color") 37 | public String strokeColor = "#FF0000"; 38 | 39 | @Setting("stroke-opacity") 40 | public double strokeOpacity = 0.8d; 41 | 42 | @Setting("stroke-weight") 43 | public int strokeWeight = 3; 44 | 45 | @Setting("fill-color") 46 | public String fillColor = "#FF0000"; 47 | 48 | @Setting("fill-opacity") 49 | public double fillOpacity = 0.35d; 50 | 51 | @Setting("label") 52 | public String label = "none"; 53 | 54 | public DynmapOwnerStyleCategory() { 55 | } 56 | 57 | public DynmapOwnerStyleCategory(ClaimType type) { 58 | if (type.equals(ClaimTypes.ADMIN)) { 59 | this.strokeColor = "#FF0000"; 60 | this.fillColor = "#FF0000"; 61 | } else if (type.equals(ClaimTypes.BASIC)) { 62 | this.strokeColor = "#FFFF00"; 63 | this.fillColor = "#FFFF00"; 64 | } else if (type.equals(ClaimTypes.TOWN)) { 65 | this.strokeColor = "#00FF00"; 66 | this.fillColor = "#00FF00"; 67 | } else if (type.equals(ClaimTypes.SUBDIVISION)) { 68 | this.strokeColor = "#FF9C00"; 69 | this.fillColor = "#FF9C00"; 70 | } else { 71 | this.strokeColor = "#FF0000"; 72 | this.fillColor = "#FF0000"; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/category/SquaremapOwnerStyleCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config.category; 26 | 27 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 28 | import org.spongepowered.configurate.objectmapping.meta.Setting; 29 | 30 | import com.griefdefender.api.claim.ClaimType; 31 | import com.griefdefender.api.claim.ClaimTypes; 32 | 33 | @ConfigSerializable 34 | public class SquaremapOwnerStyleCategory { 35 | 36 | @Setting("line-color") 37 | public String lineColor = "#FF0000"; 38 | 39 | @Setting("stroke-weight") 40 | public int Stroke_Weight = 1; 41 | 42 | @Setting("stroke-opacity") 43 | public double Stroke_Opacity = 1.0D; 44 | 45 | @Setting("fill-color") 46 | public String fillColor = "#FF0000"; 47 | 48 | @Setting("fill-opacity") 49 | public double Fill_Opacity = 0.2D; 50 | 51 | @Setting("label") 52 | public String label = "none"; 53 | 54 | public SquaremapOwnerStyleCategory() { 55 | } 56 | 57 | public SquaremapOwnerStyleCategory(ClaimType type) { 58 | if (type.equals(ClaimTypes.ADMIN)) { 59 | this.lineColor = "#FF0000"; 60 | this.fillColor = "#FF0000"; 61 | } else if (type.equals(ClaimTypes.BASIC)) { 62 | this.lineColor = "#FFFF00"; 63 | this.fillColor = "#FFFF00"; 64 | } else if (type.equals(ClaimTypes.TOWN)) { 65 | this.lineColor = "#00FF00"; 66 | this.fillColor = "#00FF00"; 67 | } else if (type.equals(ClaimTypes.SUBDIVISION)) { 68 | this.lineColor = "#FF9C00"; 69 | this.fillColor = "#FF9C00"; 70 | } else { 71 | this.lineColor = "#FF0000"; 72 | this.fillColor = "#FF0000"; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/event/GDClanTrustClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.event; 26 | 27 | import java.util.List; 28 | import java.util.Set; 29 | 30 | import com.griefdefender.api.Clan; 31 | import com.griefdefender.api.claim.Claim; 32 | import com.griefdefender.api.claim.TrustType; 33 | import com.griefdefender.api.event.ClanTrustClaimEvent; 34 | 35 | public class GDClanTrustClaimEvent extends GDTrustClaimEvent implements ClanTrustClaimEvent { 36 | 37 | private Set clans; 38 | 39 | public GDClanTrustClaimEvent(Claim claim, Set clans, TrustType trustType) { 40 | super(claim, trustType); 41 | this.clans = clans; 42 | } 43 | 44 | public GDClanTrustClaimEvent(List claims, Set clans, TrustType trustType) { 45 | super(claims, trustType); 46 | this.clans = clans; 47 | } 48 | 49 | @Override 50 | public Set getClans() { 51 | return this.clans; 52 | } 53 | 54 | public static class Add extends GDClanTrustClaimEvent implements ClanTrustClaimEvent.Add { 55 | public Add(List claims, Set clans, TrustType trustType) { 56 | super(claims, clans, trustType); 57 | } 58 | 59 | public Add(Claim claim, Set clans, TrustType trustType) { 60 | super(claim, clans, trustType); 61 | } 62 | } 63 | 64 | public static class Remove extends GDClanTrustClaimEvent implements ClanTrustClaimEvent.Remove { 65 | public Remove(List claims, Set clans, TrustType trustType) { 66 | super(claims, clans, trustType); 67 | } 68 | 69 | public Remove(Claim claim, Set clans, TrustType trustType) { 70 | super(claim, clans, trustType); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/listener/GDShopEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.listener; 26 | 27 | import org.bukkit.Location; 28 | import org.bukkit.entity.Player; 29 | import org.checkerframework.checker.nullness.qual.NonNull; 30 | 31 | import com.griefdefender.api.GriefDefender; 32 | import com.griefdefender.api.event.Event; 33 | import com.griefdefender.api.event.ProcessInteractBlockEvent; 34 | import com.griefdefender.hooks.GDHooks; 35 | 36 | import com.griefdefender.lib.kyori.event.EventBus; 37 | import com.griefdefender.lib.kyori.event.EventSubscriber; 38 | 39 | 40 | public class GDShopEventListener { 41 | 42 | public GDShopEventListener() { 43 | final EventBus eventBus = GriefDefender.getEventManager().getBus(); 44 | 45 | eventBus.subscribe(ProcessInteractBlockEvent.class, new EventSubscriber() { 46 | @Override 47 | public void on(@NonNull ProcessInteractBlockEvent event) throws Throwable { 48 | final Player player = (Player) event.getUser().getOnlinePlayer(); 49 | if (player == null) { 50 | return; 51 | } 52 | 53 | if (!GriefDefender.getCore().isEnabled(player.getWorld().getUID())) { 54 | return; 55 | } 56 | 57 | final Location location = (Location) event.getClickedBlockLocation(); 58 | if (GDHooks.getInstance().getShopProvider() != null) { 59 | // Ignore ShopChest locations 60 | if (GDHooks.getInstance().getShopProvider().isLocationShop(location)) { 61 | event.cancelled(true); 62 | } 63 | } 64 | } 65 | }); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/command/CommandVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.command; 26 | 27 | import co.aikar.commands.BaseCommand; 28 | import co.aikar.commands.annotation.CommandAlias; 29 | import co.aikar.commands.annotation.CommandPermission; 30 | import co.aikar.commands.annotation.Description; 31 | import co.aikar.commands.annotation.Subcommand; 32 | 33 | import com.griefdefender.api.GriefDefender; 34 | import com.griefdefender.hooks.GDHooks; 35 | import com.griefdefender.hooks.permission.GDHooksPermissions; 36 | 37 | import com.griefdefender.lib.kyori.adventure.text.Component; 38 | import com.griefdefender.lib.kyori.adventure.text.format.NamedTextColor; 39 | import org.bukkit.Bukkit; 40 | import org.bukkit.command.CommandSender; 41 | 42 | @CommandAlias("gdhooks") 43 | @CommandPermission(GDHooksPermissions.COMMAND_VERSION) 44 | public class CommandVersion extends BaseCommand { 45 | 46 | @CommandAlias("gdhooksversion") 47 | @Description("%version") 48 | @Subcommand("version") 49 | public void execute(CommandSender src) { 50 | Component gpVersion = Component.text() 51 | .append(GDHooks.GDHOOKS_TEXT) 52 | .append(Component.text("Running ")) 53 | .append(Component.text("GDHooks " + GDHooks.IMPLEMENTATION_VERSION, NamedTextColor.AQUA)) 54 | .build(); 55 | Component bukkitVersion = Component.text() 56 | .append(GDHooks.GDHOOKS_TEXT) 57 | .append(Component.text("Running ")) 58 | .append(Component.text(Bukkit.getVersion(), NamedTextColor.YELLOW)) 59 | .build(); 60 | 61 | GriefDefender.getAudienceProvider().getSender(src).sendMessage(Component.text() 62 | .append(gpVersion) 63 | .append(Component.newline()) 64 | .append(bukkitVersion) 65 | .build()); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/MessageConfigData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 31 | import org.spongepowered.configurate.objectmapping.meta.Setting; 32 | 33 | import com.google.common.collect.ImmutableMap; 34 | import com.griefdefender.hooks.config.category.ConfigCategory; 35 | import com.griefdefender.hooks.util.LegacyHexSerializer; 36 | 37 | import com.griefdefender.lib.kyori.adventure.text.Component; 38 | 39 | @ConfigSerializable 40 | public class MessageConfigData extends ConfigCategory { 41 | 42 | @Setting("descriptions") 43 | public Map descriptionMap = new HashMap<>(); 44 | 45 | @Setting("messages") 46 | public Map messageMap = new HashMap<>(); 47 | 48 | public Component getDescription(String message) { 49 | String rawMessage = this.descriptionMap.get(message); 50 | if (rawMessage == null) { 51 | // Should never happen but in case it does, return empty 52 | return Component.empty(); 53 | } 54 | 55 | return LegacyHexSerializer.deserialize(rawMessage); 56 | } 57 | 58 | public Component getMessage(String message) { 59 | return this.getMessage(message, ImmutableMap.of()); 60 | } 61 | 62 | public Component getMessage(String message, Map paramMap) { 63 | String rawMessage = this.messageMap.get(message); 64 | if (rawMessage == null) { 65 | // Should never happen but in case it does, return empty 66 | return Component.empty(); 67 | } 68 | for (Map.Entry entry : paramMap.entrySet()) { 69 | final String key = entry.getKey(); 70 | Object value = entry.getValue(); 71 | if (value instanceof Component) { 72 | value = LegacyHexSerializer.serialize((Component) value); 73 | } 74 | rawMessage = rawMessage.replace("{" + key + "}", value.toString()); 75 | } 76 | 77 | return LegacyHexSerializer.deserialize(rawMessage); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/ClanConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config; 26 | 27 | import java.io.IOException; 28 | import java.nio.file.Files; 29 | import java.nio.file.Path; 30 | import java.util.logging.Level; 31 | 32 | import org.spongepowered.configurate.CommentedConfigurationNode; 33 | import org.spongepowered.configurate.hocon.HoconConfigurationLoader; 34 | import org.spongepowered.configurate.objectmapping.ObjectMapper; 35 | 36 | import com.griefdefender.hooks.GDHooks; 37 | 38 | public class ClanConfig { 39 | 40 | private HoconConfigurationLoader loader; 41 | private CommentedConfigurationNode root; 42 | private ObjectMapper configMapper; 43 | private ClanConfigData data; 44 | 45 | public ClanConfig(Path path) { 46 | 47 | try { 48 | if (Files.notExists(path.getParent())) { 49 | Files.createDirectories(path.getParent()); 50 | } 51 | if (Files.notExists(path)) { 52 | Files.createFile(path); 53 | } 54 | 55 | this.loader = HoconConfigurationLoader.builder().path(path).build(); 56 | this.configMapper = GDHooks.OBJECTMAPPER_FACTORY.get(ClanConfigData.class); 57 | 58 | if (reload()) { 59 | save(); 60 | } 61 | } catch (Exception e) { 62 | GDHooks.getInstance().getLogger().log(Level.SEVERE, "Failed to initialize configuration", e); 63 | } 64 | } 65 | 66 | public ClanConfigData getData() { 67 | return this.data; 68 | } 69 | 70 | public void save() { 71 | try { 72 | this.configMapper.save(this.data, this.root.node(GDHooks.MOD_ID)); 73 | this.loader.save(this.root); 74 | } catch (IOException e) { 75 | GDHooks.getInstance().getLogger().log(Level.SEVERE, "Failed to save configuration", e); 76 | } 77 | } 78 | 79 | public boolean reload() { 80 | try { 81 | this.root = this.loader.load(); 82 | this.data = this.configMapper.load(this.root.node(GDHooks.MOD_ID)); 83 | } catch (Exception e) { 84 | GDHooks.getInstance().getLogger().log(Level.SEVERE, "Failed to load configuration", e); 85 | return false; 86 | } 87 | return true; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/BreweryProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider; 26 | 27 | import org.bukkit.Bukkit; 28 | import org.bukkit.Location; 29 | import org.bukkit.block.Block; 30 | import org.bukkit.entity.Player; 31 | import org.bukkit.event.EventHandler; 32 | import org.bukkit.event.EventPriority; 33 | import org.bukkit.event.Listener; 34 | 35 | import com.dre.brewery.BCauldron; 36 | import com.dre.brewery.Barrel; 37 | import com.dre.brewery.api.events.barrel.BarrelAccessEvent; 38 | import com.griefdefender.api.GriefDefender; 39 | import com.griefdefender.api.claim.Claim; 40 | import com.griefdefender.api.claim.TrustTypes; 41 | import com.griefdefender.api.data.PlayerData; 42 | import com.griefdefender.hooks.GDHooksBootstrap; 43 | 44 | public class BreweryProvider implements Listener { 45 | 46 | public BreweryProvider() { 47 | Bukkit.getPluginManager().registerEvents(this, GDHooksBootstrap.getInstance().getLoader()); 48 | } 49 | 50 | @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) 51 | public void onBarrelAccess(BarrelAccessEvent event) { 52 | final Player player = event.getPlayer(); 53 | final PlayerData playerData = GriefDefender.getCore().getPlayerData(player.getWorld().getUID(), player.getUniqueId()); 54 | final Location location = event.getClickedBlock().getLocation(); 55 | final Claim claim = GriefDefender.getCore().getClaimAt(location); 56 | if (claim == null || !GriefDefender.getCore().isEnabled(player.getWorld().getUID()) || playerData.canIgnoreClaim(claim)) { 57 | return; 58 | } 59 | 60 | if (playerData.inPvpCombat()) { 61 | event.setCancelled(true); 62 | return; 63 | } 64 | 65 | if (!playerData.canUseBlock(location, TrustTypes.CONTAINER, false, false)) { 66 | event.setCancelled(true); 67 | return; 68 | } 69 | } 70 | 71 | public String getBlockId(Block block) { 72 | final Barrel barrel = Barrel.get(block); 73 | if (barrel != null) { 74 | return "brewery:barrel"; 75 | } 76 | final BCauldron cauldron = BCauldron.get(block); 77 | if (cauldron != null) { 78 | return "brewery:cauldron"; 79 | } 80 | return null; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/GDHooksConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config; 26 | 27 | import java.io.IOException; 28 | import java.nio.file.Files; 29 | import java.nio.file.Path; 30 | import java.util.logging.Level; 31 | 32 | import org.spongepowered.configurate.CommentedConfigurationNode; 33 | import org.spongepowered.configurate.hocon.HoconConfigurationLoader; 34 | import org.spongepowered.configurate.objectmapping.ObjectMapper; 35 | 36 | import com.griefdefender.hooks.GDHooks; 37 | 38 | public class GDHooksConfig { 39 | 40 | private HoconConfigurationLoader loader; 41 | private CommentedConfigurationNode root; 42 | private ObjectMapper configMapper; 43 | private GDHooksConfigData data; 44 | 45 | public GDHooksConfig(Path path) { 46 | 47 | try { 48 | if (Files.notExists(path.getParent())) { 49 | Files.createDirectories(path.getParent()); 50 | } 51 | if (Files.notExists(path)) { 52 | Files.createFile(path); 53 | } 54 | 55 | this.loader = HoconConfigurationLoader.builder().path(path).build(); 56 | this.configMapper = GDHooks.OBJECTMAPPER_FACTORY.get(GDHooksConfigData.class); 57 | 58 | if (reload()) { 59 | save(); 60 | } 61 | } catch (Exception e) { 62 | GDHooks.getInstance().getLogger().log(Level.SEVERE, "Failed to initialize configuration", e); 63 | } 64 | } 65 | 66 | public GDHooksConfigData getData() { 67 | return this.data; 68 | } 69 | 70 | public void save() { 71 | try { 72 | this.configMapper.save(this.data, this.root.node(GDHooks.MOD_ID)); 73 | this.loader.save(this.root); 74 | } catch (IOException e) { 75 | GDHooks.getInstance().getLogger().log(Level.SEVERE, "Failed to save configuration", e); 76 | } 77 | } 78 | 79 | public boolean reload() { 80 | try { 81 | this.root = this.loader.load(); 82 | this.data = this.configMapper.load(this.root.node(GDHooks.MOD_ID)); 83 | } catch (Exception e) { 84 | GDHooks.getInstance().getLogger().log(Level.SEVERE, "Failed to load configuration", e); 85 | return false; 86 | } 87 | return true; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/util/LegacyHexSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.util; 26 | 27 | import java.time.Duration; 28 | 29 | import com.griefdefender.lib.kyori.adventure.text.Component; 30 | import com.griefdefender.lib.kyori.adventure.text.TextComponent; 31 | import com.griefdefender.lib.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; 32 | import com.griefdefender.lib.kyori.adventure.title.Title; 33 | import com.griefdefender.lib.kyori.adventure.title.Title.Times; 34 | 35 | public class LegacyHexSerializer { 36 | 37 | private static LegacyComponentSerializer HEX_SERIALIZER = LegacyComponentSerializer.builder().extractUrls().hexColors().character(LegacyComponentSerializer.AMPERSAND_CHAR).build(); 38 | 39 | public static String serialize(Component component) { 40 | return HEX_SERIALIZER.serialize(component); 41 | } 42 | 43 | public static TextComponent deserialize(String componentStr) { 44 | TextComponent component = null; 45 | try { 46 | component = HEX_SERIALIZER.deserialize(componentStr); 47 | return component; 48 | } catch (Throwable t) { 49 | return Component.empty(); 50 | } 51 | } 52 | 53 | public static Title deserializeTitle(String title) { 54 | String[] parts = title.split(";"); 55 | Component titleMain = HEX_SERIALIZER.deserialize(parts[0]); 56 | Component titleSub = HEX_SERIALIZER.deserialize(parts[1]); 57 | Duration fadeIn = Duration.ofSeconds(Long.valueOf(parts[2])); 58 | Duration timeStay = Duration.ofSeconds(Long.valueOf(parts[3])); 59 | Duration fadeOut = Duration.ofSeconds(Long.valueOf(parts[4])); 60 | return Title.title(titleMain, titleSub, Times.of(fadeIn, timeStay, fadeOut)); 61 | } 62 | 63 | public static String serializeTitle(Title title) { 64 | String titleMain = HEX_SERIALIZER.serialize(title.title()); 65 | String titleSub = HEX_SERIALIZER.serialize(title.subtitle()); 66 | String fadeIn = String.valueOf(title.times().fadeIn().getSeconds()); 67 | String timeStay = String.valueOf(title.times().stay().getSeconds()); 68 | String fadeOut = String.valueOf(title.times().fadeOut().getSeconds()); 69 | return titleMain + ";" + titleSub + ";" + fadeIn + ";" + timeStay + ";" + fadeOut; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/GDHooksRelocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks; 26 | 27 | import java.io.File; 28 | import java.io.IOException; 29 | import java.nio.file.Paths; 30 | import java.util.ArrayList; 31 | import java.util.HashSet; 32 | import java.util.List; 33 | import java.util.Map; 34 | import java.util.Set; 35 | 36 | import com.griefdefender.hooks.plugin.ClassPathAppender; 37 | 38 | import me.lucko.jarrelocator.JarRelocator; 39 | import me.lucko.jarrelocator.Relocation; 40 | 41 | public class GDHooksRelocator { 42 | 43 | private List rules; 44 | private Set relocationKeys = new HashSet<>(); 45 | private final ClassPathAppender classPathAppender; 46 | 47 | public GDHooksRelocator(ClassPathAppender classPathAppender) { 48 | this.classPathAppender = classPathAppender; 49 | this.rules = new ArrayList<>(); 50 | for (String name : GDHooksBootstrap.getInstance().getRelocateList()) { 51 | final String[] relocations = name.split("\\|"); 52 | for (String relocation : relocations) { 53 | final String[] parts = relocation.split(":"); 54 | final String key = parts[0]; 55 | final String relocated = parts[1]; 56 | if (!this.relocationKeys.contains(key)) { 57 | this.relocationKeys.add(key); 58 | this.rules.add(new Relocation(key, "com.griefdefender.hooks.lib." + relocated)); 59 | } 60 | } 61 | } 62 | } 63 | 64 | public void relocateJars(Map jarMap) { 65 | for (Map.Entry mapEntry : jarMap.entrySet()) { 66 | final String name = mapEntry.getKey(); 67 | final File input = mapEntry.getValue(); 68 | final File output = Paths.get(input.getParentFile().getPath()).resolve(input.getName().replace(".jar", "") + "-shaded.jar").toFile(); 69 | if (!output.exists()) { 70 | // Relocate 71 | JarRelocator relocator = new JarRelocator(input, output, this.rules); 72 | 73 | try { 74 | relocator.run(); 75 | } catch (IOException e) { 76 | throw new RuntimeException("Unable to relocate", e); 77 | } 78 | } 79 | this.classPathAppender.addJarToClasspath(output.toPath()); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/pl_PL.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | trust-clan="Zezwala clan na dostęp do działki.\nAccessor (Gość): Interakcje z blokami bez dostępu do pojemników.\nContainer (Magazynier): Dodatkowy dostęp do skrzyń i innych pojemników.\nBuilder (Budowniczy): Możliwość stawiania i niszczenia bloków.\nManager (Manager): Dodatkowa możliwość zmiany ustawień działki." 4 | trust-clan-all="Zezwala clan na dostęp do WSZYSTKICH działek.\nAccessor (Gość): Interakcje z blokami bez dostępu do pojemników.\nContainer (Magazynier): Dodatkowy dostęp do skrzyń i innych pojemników.\nBuilder (Budowniczy): Możliwość stawiania i niszczenia bloków.\nManager (Manager): Dodatkowa możliwość zmiany ustawień działki." 5 | untrust-clan="Usuwa clan z listy dostępu do działki." 6 | untrust-clan-all="Usuwa clan z list dostępu do wszystkich działek." 7 | version="Wyświetla informację o wersji pluginu." 8 | } 9 | messages { 10 | claim-disabled-world="&cDziałki są wyłączone w tym świecie." 11 | command-invalid="&cNie poznaję takiej komendy. Sprawdź poprawność." 12 | command-invalid-claim="&cTa komenda nie może być użyta na działce typu {type}&c." 13 | command-invalid-group="&cGrupa &6{group}&c nie jest prawidłowa." 14 | command-invalid-input="&cNieprawidłowe polecenie '{input}&c'." 15 | command-invalid-player="&c&6{player}&c nie jest prawidłowym celem. Sprawdź poprawność." 16 | command-invalid-player-group="&cNieprawidłowa grupa lub nazwa gracza." 17 | command-invalid-type="&c{type}&c nie jest prawidłowym typem." 18 | command-world-not-found="&cŚwiat '&6{world}&c' nie został znaleziony." 19 | permission-access="&cNie posiadasz zezwolenia na dostęp, które może wydać &6{player}&c." 20 | permission-build="&cNie masz pozwolenia na budowanie od &6{player}&c." 21 | permission-build-near-claim="&cNie masz pozwolenia na budowanie w pobliżu działki &6{player}&c." 22 | permission-command-trust="&cNie masz permisji na używanie tego typu 'trust'." 23 | permission-edit-claim="&cNie masz permisji do zmiany tej działki." 24 | permission-interact-block="&cPotrzebujesz pozwolenia od gracza &6{player} &caby wchodzić w interakcje z blokiem &d{block}&c." 25 | permission-interact-entity="&cPotrzebujesz pozwolenia od gracza &6{player} &caby wchodzić w interakcje z obiektem &d{entity}&c." 26 | permission-interact-item="&cPotrzebujesz pozwolenia od gracza &6{player} &caby wchodzić w interakcje z przedmiotem &d{item}&c." 27 | permission-interact-item-block="&cNie masz permisji by użyć przedmiot &d{item}&c na bloku &b{block}&c." 28 | permission-interact-item-entity="&cNie masz permisji aby użyć &d{item}&c na &b{entity}&c." 29 | permission-inventory-open="&cNie masz pozwolenia od gracza &6{player}&c aby otworzyć &d{block}&c." 30 | permission-item-drop="&cNie masz pozwolenia od gracza &6{player}&c aby wyrzucić &d{item}&c na tej działce." 31 | permission-item-use="&cNie możesz używać &d{item}&c na tej działce." 32 | permission-option-use="&cNie masz permisji do używania tej opcji." 33 | permission-override-deny="&cAkcja, którą próbujesz wykonać została zablokowana poprzez administratora, który nadpisał tę możliwość." 34 | plugin-event-cancel="&cPlugin anulował tę akcję." 35 | plugin-reload="&aGDHooks został załadowany od nowa." 36 | trust-already-has="&c{target} już posiada permisję {type}&c." 37 | trust-grant="&6{target} &aotrzymuje permisję {type}&a na obecnej działce." 38 | trust-invalid="&cNiewłaściwy typ 'trust'.\nDostępne typy to : accessor (Gość), builder (Budowniczy), container (Magazynier), oraz manager (Manager)." 39 | trust-no-claims="&cNie masz działek, żeby nadać permisje." 40 | trust-plugin-cancel="&cNie można nadać praw {target}&c. Plugin odmówił." 41 | trust-self="&cNie możesz nadać tej permisji sobie." 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/command/clan/CommandClanUntrustRank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.command.clan; 26 | 27 | import co.aikar.commands.BaseCommand; 28 | import co.aikar.commands.annotation.CommandAlias; 29 | import co.aikar.commands.annotation.CommandCompletion; 30 | import co.aikar.commands.annotation.CommandPermission; 31 | import co.aikar.commands.annotation.Description; 32 | import co.aikar.commands.annotation.Subcommand; 33 | import co.aikar.commands.annotation.Syntax; 34 | 35 | import org.bukkit.entity.Player; 36 | 37 | import com.google.common.collect.ImmutableMap; 38 | import com.griefdefender.api.Clan; 39 | import com.griefdefender.api.ClanPlayer; 40 | import com.griefdefender.api.GriefDefender; 41 | import com.griefdefender.api.claim.TrustType; 42 | import com.griefdefender.hooks.GDHooks; 43 | import com.griefdefender.hooks.config.ClanConfig; 44 | import com.griefdefender.hooks.config.MessageConfig; 45 | import com.griefdefender.hooks.permission.GDHooksPermissions; 46 | import com.griefdefender.hooks.util.HooksUtil; 47 | 48 | import com.griefdefender.lib.kyori.adventure.audience.Audience; 49 | import com.griefdefender.lib.kyori.adventure.text.Component; 50 | 51 | @CommandAlias("gdhooks") 52 | @CommandPermission(GDHooksPermissions.COMMAND_UNTRUST_RANK) 53 | public class CommandClanUntrustRank extends BaseCommand { 54 | 55 | @CommandCompletion("@gdclanranks @gdtrusttypes @gddummy") 56 | @CommandAlias("clanuntrustrank") 57 | @Description("%clan-untrust-rank") 58 | @Syntax("") 59 | @Subcommand("clan untrust rank") 60 | public void execute(Player player, String rank) { 61 | final Audience audience = GriefDefender.getAudienceProvider().getSender(player); 62 | final ClanPlayer clanPlayer = GDHooks.getInstance().getClanProvider().getClanPlayer(player.getUniqueId()); 63 | if (clanPlayer == null) { 64 | return; 65 | } 66 | final Clan clan = clanPlayer.getClan(); 67 | if (clan == null) { 68 | return; 69 | } 70 | 71 | if (!clanPlayer.isLeader()) { 72 | return; 73 | } 74 | 75 | final ClanConfig clanConfig = GDHooks.getInstance().getClanConfigMap().get(clan.getTag()); 76 | if (clanConfig == null) { 77 | return; 78 | } 79 | final TrustType trustType = clanConfig.getData().getRankTrust(rank); 80 | clanConfig.getData().deleteRankTrust(rank); 81 | clanConfig.save(); 82 | final Component message = MessageConfig.MESSAGE_DATA.getMessage(MessageConfig.CLAN_UNTRUST_RANK, ImmutableMap.of( 83 | "rank", rank, 84 | "type", trustType.getName())); 85 | audience.sendMessage(message); 86 | } 87 | } -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/ru_RU.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | trust-clan="Выдать группе доступ к вашему региону.\nAccessor: доступ к взаимодействию со всем, кроме инвентарей.\nContainer: доступ к взаимодействию со всем, включая инвентари.\nBuilder: доступ ко всему вышеперечисленному плюс установка и поломка блоков.\nManager: доступ ко всему вышеперечисленному плюс возможность изменять настройки региона." 4 | trust-clan-all="Выдать группе доступ ко ВСЕМ вашим регионам.\nAccessor: доступ к взаимодействию со всем, кроме инвентарей.\nContainer: доступ к взаимодействию со всем, включая инвентари.\nBuilder: доступ ко всему вышеперечисленному плюс установка и поломка блоков.\nManager: доступ ко всему вышеперечисленному плюс возможность изменять настройки региона." 5 | untrust-clan="Отозвать доступ группы к вашему региону." 6 | untrust-clan-all="Отозвать доступ группы ко ВСЕМ вашим регионам." 7 | version="Вывести информацию о версии GDHooks." 8 | } 9 | messages { 10 | claim-disabled-world="&cВ этом мире нельзя создать регион." 11 | command-invalid="&cКоманда не найдена." 12 | command-invalid-claim="&cЭту команду нельзя использовать в регионах вида &f{type}&c." 13 | command-invalid-group="&cГруппа &6{group}&c не существует." 14 | command-invalid-input="&cНеверный ввод для команды '{input}&c'." 15 | command-invalid-player="&cИгрок &6{player}&c не найден." 16 | command-invalid-player-group="&cНе является игроком или группой." 17 | command-invalid-type="&cТип {type}&c не найден." 18 | command-world-not-found="&cМир '&6{world}&c' не найден." 19 | permission-access="&cУ вас нет разрешения от игрока &6{player}&c на доступ к этому." 20 | permission-build="&cУ вас нет разрешения от игрока &6{player}&c на строительство." 21 | permission-build-near-claim="&cУ вас нет разрешения от игрока &6{player}&c на строительство около его региона." 22 | permission-command-trust="&cУ вас нет разрешения на выдачу этого вида разрешения." 23 | permission-edit-claim="&cУ вас нет разрешения на изменение этого региона." 24 | permission-interact-block="&cУ вас нет разрешения от игрока &6{player}&c на взаимодействие с блоком &d{block}&c." 25 | permission-interact-entity="&cУ вас нет разрешения от игрока &6{player}&c на взаимодействие с сущностью &d{entity}&c." 26 | permission-interact-item="&cУ вас нет разрешения от игрока &6{player}&c на взаимодействие с предметом &d{item}&c." 27 | permission-interact-item-block="&cУ вас нет разрешения на использование предмета &d{item}&c на блок &b{block}&c." 28 | permission-interact-item-entity="&cУ вас нет разрешения на использование предмета &d{item}&c на сущность &b{entity}&c." 29 | permission-inventory-open="&cУ вас нет разрешения от игрока &6{player}&c на открытие &d{block}&c." 30 | permission-item-drop="&cУ вас нет разрешения от игрока &6{player}&c на выбрасывание предмета &d{item}&c." 31 | permission-item-use="&cУ вас нет разрешения на использование предмета &d{item}&c." 32 | permission-option-use="&cУ вас нет разрешения на использование этой опции." 33 | permission-override-deny="&cДействие, которое вы пытаетесь совершить, было отменено флагом, переопределённым администратором." 34 | plugin-event-cancel="&cПлагин отменил это действие." 35 | plugin-reload="&aGDHooks перезагружен." 36 | trust-already-has="&cУ пользователя &f{target}&c уже есть разрешение вида &f{type}&c." 37 | trust-grant="&aИгрок &6{target}&a теперь имеет разрешения вида {type}&a для текущего региона." 38 | trust-invalid="&cНеверный вид разрешения.\nДоступные виды: accessor, builder, container и manager." 39 | trust-no-claims="&cУ вас нет регионов, в которые можно было бы вписать игрока." 40 | trust-plugin-cancel="&cНе удалось выдать разрешения игроку &f{target}&c. Плагин не разрешил." 41 | trust-self="&cНикому нельзя доверять. Особенно себе." 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/de_DE.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | trust-clan="Gibt einer clan Rechte für dein Grundstück.\nAccessor: Kann mit allen Blöcken interagieren außer Inventarblöcken.\nContainer: Alle Blöcke, inklusive Inventarblöcke wie bspw. Kisten.\nBuilder: Wie oben + die Fähigkeit Blöcke zu setzen und abzubauen.\nManager: Alle oberen Einstellungen + Die Fähigkeit Optionen des Grundstückes zu ändern." 4 | trust-clan-all="Gibt einer clan Rechte für ALLE deine Grundstücke.\nAccessor: Kann mit allen Blöcken interagieren außer Inventarblöcken.\nContainer: Alle Blöcke, inklusive Inventarblöcke wie bspw. Kisten.\nBuilder: Wie oben + die Fähigkeit Blöcke zu setzen und abzubauen.\nManager: Alle oberen Einstellungen + Die Fähigkeit Optionen des Grundstückes zu ändern." 5 | untrust-clan="Entfernt die Rechte der clan von deinem Grundstück." 6 | untrust-clan-all="Entfernt die Rechte der clan von allen deinen Grundstücken." 7 | version="Zeigt dir die GDHooks Version." 8 | } 9 | messages { 10 | claim-disabled-world="&cGrundstücke sind in dieser Welt deaktiviert." 11 | command-invalid="&cKein gültiger Befehl." 12 | command-invalid-claim="&cDieser Befehl kann nicht auf {type}&c Grundstücken benutzt werden." 13 | command-invalid-group="&c &6{group}&c ist keine gültige Gruppe." 14 | command-invalid-input="&cUngültiger Befehl '{input}&c'." 15 | command-invalid-player="&6{player}&c ist kein gültiger Spieler." 16 | command-invalid-player-group="&cSpieler oder Gruppe nicht existent." 17 | command-invalid-type="&cTyp {type}&c existiert nicht." 18 | command-world-not-found="&cWelt '&6{world}&c' nicht gefunden." 19 | permission-access="&cDir fehlt die Berechtigung von &6{player}&c um das zu tun." 20 | permission-build="&cDir fehlt die Berechtigung von &6{player}&c um bauen zu können." 21 | permission-build-near-claim="&cDir fehlt die Berechtigung von &6{player}&c um neben dem Grundstück bauen zu können." 22 | permission-command-trust="&cDu hast keine Berechtigung dieses Vertrauenslevel zu nutzen." 23 | permission-edit-claim="&cDu hast keine Berechtigung dieses Grundstück zu bearbeiten." 24 | permission-interact-block="&cDir fehlt die Berechtigung von &6{player} &cum mit &d{block}&c zu interagieren." 25 | permission-interact-entity="&cDir fehlt die Berechtigung von &6{player} &cum mit &d{entity}&c zu interagieren." 26 | permission-interact-item="&cDir fehlt die Berechtigung von &6{player} &cum mit &d{item}&c zu interagieren." 27 | permission-interact-item-block="&cDu hast keine Berechtigung um &d{item}&c mit &b{block}&c zu nutzen." 28 | permission-interact-item-entity="&cDu hast keine Berechtigung um &d{item}&c mit &b{entity}&c zu nutzen." 29 | permission-inventory-open="&cDir fehlt die Berechtigung von &6{player}&c um &d{block}&c zu öffnen." 30 | permission-item-drop="&cDir fehlt die Berechtigung von &6{player}&c um hier &d{item}&c fallenzulassen." 31 | permission-item-use="&cDu kannst &d{item}&c in diesem Claim nicht benutzen." 32 | permission-option-use="&cDu hast keine Berechtigung diese Option zu benutzen." 33 | permission-override-deny="&cDie Aktion, die du gerade versuchst, wurde von einem Admin blockiert." 34 | plugin-event-cancel="&cEin Plugin hat deine Aktion blockiert." 35 | plugin-reload="&aGDHooks neu geladen." 36 | trust-already-has="&c{target} hat bereits die Berechtigung {type}&c." 37 | trust-grant="&6{target}&a hat nun {type}&a Berechtigungen für dieses Grundstück." 38 | trust-invalid="&cUngültige Erlaubnis.\nEs gibt : accessor (Zugriff), builder (Bauen), container (Kisten), und manager (Verwaltung)." 39 | trust-no-claims="&cDu hast keine Grundstücke." 40 | trust-plugin-cancel="&cKonnte {target}&c keine Erlaubnis erteilen. Ein Plugin hat dies verhindert." 41 | trust-self="&cDu kannst dir selbst Rechte für Grundstücke erteilen." 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/it_IT.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | trust-clan="Fornisce i permessi ad un clan nella tua zona.\nAccesso: permette di interagire con tutti i blocchi eccetto gli inventari.\nContenitori: permette di interagire con tutti i blocchi, inclusi gli inventari.\nCostruttore: permette di accedere a tutto oltre che rompere e piazzare blocchi.\nGestore: permette di fare tutto, inclusa la modifica delle impostazioni della zona." 4 | trust-clan-all="Fornisce i permessi ad un clan in tutte le tue zone.\nAccesso: permette di interagire con tutti i blocchi eccetto gli inventari.\nContenitori: permette di interagire con tutti i blocchi, inclusi gli inventari.\nCostruttore: permette di accedere a tutto oltre che rompere e piazzare blocchi.\nGestore: permette di fare tutto, inclusa la modifica delle impostazioni della zona." 5 | untrust-clan="Rimuovi i permessi di un clan dalla tua zona protetta." 6 | untrust-clan-all="Rimuovi i permessi di un clan da tutte le tue zone protette." 7 | version="Mostra la versione di GDHooks." 8 | } 9 | messages { 10 | claim-disabled-world="&cLe protezioni sono disabilitate in questo mondo." 11 | command-invalid="&cNessun comando valido inserito." 12 | command-invalid-claim="&cQuesto comando non può essere usato nelle zone {type}&c." 13 | command-invalid-group="&cIl gruppo &6{group}&c non è valido." 14 | command-invalid-input="&cInput non valido '{input}&c'." 15 | command-invalid-player="&cIl giocatore &6{player}&c non è valido." 16 | command-invalid-player-group="&cNessun giocatore o gruppo valido." 17 | command-invalid-type="&cTipo specificato non valido ({type}&c)." 18 | command-world-not-found="&cMondo '&6{world}&c' non trovato." 19 | permission-access="&cNon hai il permesso di &6{player}&c per accedere a questo." 20 | permission-build="&cNon hai il permesso di&6{player}&c per costruire." 21 | permission-build-near-claim="&cNon hai il permesso di &6{player}&c per costruire vicino la sua zona." 22 | permission-command-trust="&cNon puoi utilizzare questo tipo di permesso." 23 | permission-edit-claim="&cNon hai il permesso per modificare questa zona." 24 | permission-interact-block="&cNon hai il permesso di &6{player}&c per interagire con il blocco &d{block}&c." 25 | permission-interact-entity="&cNon hai il permesso di &6{player}&c per interagire con l'entità &d{entity}&c." 26 | permission-interact-item="&cNon hai il permesso di &6{player}&c per interagire con l'oggetto &d{item}&c." 27 | permission-interact-item-block="&cNon hai il permesso per usare &d{item}&c su &b{block}&c." 28 | permission-interact-item-entity="&cNon hai il permesso per usare &d{item}&c su &b{entity}&c." 29 | permission-inventory-open="&cNon hai il permesso di &6{player}&c per aprire &d{block}&c." 30 | permission-item-drop="&cNon hai il permesso di &6{player}&c per lasciare &d{item}&c in questa zona." 31 | permission-item-use="&cNon puoi usare l'oggetto &d{item}&c in questa zona." 32 | permission-option-use="&cNon hai il permesso per usare questa opzione." 33 | permission-override-deny="&cL'azione che stai cercando di fare è stata bloccata da una flag override amministrativa." 34 | plugin-event-cancel="&cUn plugin ha annullato questa azione." 35 | plugin-reload="&aGDHooks è stato ricaricato." 36 | trust-already-has="&c{target} ha già il permesso \"{type}&c\"." 37 | trust-grant="&aDati a &6{target}&a il permesso \"{type}&a\" in questa zona." 38 | trust-invalid="&cPermesso inserito non valido.\nI tipi consentiti sono: accesso, costruttore, contenitore, e gestore." 39 | trust-list-header="Permessi in questa zona:" 40 | trust-no-claims="&cNon hai nessuna zona in cui aggiungere qualcuno." 41 | trust-plugin-cancel="&cImpossibile aggiungere {target}&c. Un plugin lo ha impedito." 42 | trust-self="&cNon puoi aggiungere te stesso." 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/simpleclans/GDClanPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.simpleclans; 26 | 27 | import java.util.UUID; 28 | 29 | import org.checkerframework.checker.nullness.qual.Nullable; 30 | 31 | import com.griefdefender.api.Clan; 32 | import com.griefdefender.api.ClanPlayer; 33 | import com.griefdefender.api.GriefDefender; 34 | import com.griefdefender.api.User; 35 | import com.griefdefender.api.claim.Claim; 36 | import com.griefdefender.api.clan.Rank; 37 | import com.griefdefender.api.data.PlayerData; 38 | import com.griefdefender.hooks.GDHooks; 39 | 40 | public class GDClanPlayer implements ClanPlayer { 41 | 42 | private final net.sacredlabyrinth.phaed.simpleclans.ClanPlayer pluginClanPlayer; 43 | private final User user; 44 | 45 | public GDClanPlayer(net.sacredlabyrinth.phaed.simpleclans.ClanPlayer clanPlayer) { 46 | this.pluginClanPlayer = clanPlayer; 47 | this.user = GriefDefender.getCore().getUser(clanPlayer.getUniqueId()); 48 | } 49 | 50 | @Override 51 | public UUID getUniqueId() { 52 | return this.pluginClanPlayer.getUniqueId(); 53 | } 54 | 55 | @Override 56 | public PlayerData getPlayerData() { 57 | return this.user.getPlayerData(); 58 | } 59 | 60 | @Override 61 | public boolean isOnline() { 62 | return this.user.isOnline(); 63 | } 64 | 65 | @Override 66 | public String getFriendlyName() { 67 | return this.user.getFriendlyName(); 68 | } 69 | 70 | @Override 71 | public String getIdentifier() { 72 | return this.user.getIdentifier(); 73 | } 74 | 75 | @Override 76 | public Clan getClan() { 77 | return GDHooks.getInstance().getClanProvider().getClan(this.pluginClanPlayer.getTag()); 78 | } 79 | 80 | @Override 81 | public @Nullable Object getOnlinePlayer() { 82 | return user.getOnlinePlayer(); 83 | } 84 | 85 | @Override 86 | public Rank getRank() { 87 | return this.getClan().getRank(this.pluginClanPlayer.getRankId()); 88 | } 89 | 90 | @Override 91 | public void setRank(Rank rank) { 92 | final net.sacredlabyrinth.phaed.simpleclans.Rank pluginRank = this.pluginClanPlayer.getClan().getRank(rank.getName()); 93 | if (pluginRank == null) { 94 | return; 95 | } 96 | this.pluginClanPlayer.setRank(rank.getName()); 97 | } 98 | 99 | @Override 100 | public @Nullable Claim getCurrentClaim() { 101 | return this.getPlayerData().getCurrentClaim(); 102 | } 103 | 104 | @Override 105 | public boolean isLeader() { 106 | return this.pluginClanPlayer.isLeader(); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/fr_FR.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | trust-clan="Donne à un clan accès à ton terrain.\nAccessor: Permet d'intéragir avec l'ensemble des blocs sans inventaire.\nContainer: Permet d'intéragir avec l'ensemble des blocs avec inventaire.\nBuilder: Permet la même chose qu'au dessus avec en plus la possibilité de placer et casser des blocs.\nManager: Permet la même chose qu'au dessus avec en plus la possibilité de gérer les paramètres de la protection." 4 | trust-clan-all="Donne à un clan l'accès à l'ENSEMBLE de tes terrains.\nAccessor: Permet d'intéragir avec l'ensemble des blocs sans inventaire.\nContainer: Permet d'intéragir avec l'ensemble des blocs avec inventaire.\nBuilder: Permet la même chose qu'au dessus avec en plus la possibilité de placer et casser des blocs.\nManager: Permet la même chose qu'au dessus avec en plus la possibilité de gérer les paramètres de la protection." 5 | untrust-clan="Supprime les accès d'un clan à ton terrain." 6 | untrust-clan-all="Supprime les accès d'un clan à l'ENSEMBLE de tes terrains." 7 | version="Affiche les informations sur la version de GDHooks." 8 | } 9 | messages { 10 | claim-disabled-world="&cLes terrains sont désactivées dans ce monde." 11 | command-invalid="&cPas de commande valide entrée." 12 | command-invalid-claim="&cCette commande ne peut être utilisée dans les terrains de type {type}&c." 13 | command-invalid-group="&cGroupe &6{group}&c n'est pas valide." 14 | command-invalid-input="&cInvalide commande entrée '{input}&c'." 15 | command-invalid-player="&cJoueur &6{player}&c n'est pas valide." 16 | command-invalid-player-group="&cPas un joueur ou groupe valide." 17 | command-invalid-type="&cType {type}&c invalide spécifié." 18 | command-world-not-found="&cMonde '&6{world}&c' introuvable." 19 | permission-access="&cTu n'as pas la permission de &6{player}&c pour accéder à ça." 20 | permission-build="&cTu n'as pas la permission de &6{player}&c pour construire." 21 | permission-build-near-claim="&cTu n'as pas la permission de &6{player}&c de construire à proximité de protection." 22 | permission-edit-claim="&cTu n'as pas la permission pour éditer cette protection." 23 | permission-interact-block="&cTu n'as pas la permission de &6{player}&c pour intéragir avec le bloc &d{block}&c." 24 | permission-interact-entity="&cTu n'as pas la permission de &6{player}&c pour intéragir avec l'entité &d{entity}&c." 25 | permission-interact-item="&cTu n'as pas la permission de &6{player}& pour intéragir avec l'objet &d{item}&c." 26 | permission-interact-item-block="&cTu n'as pas la permission d'utiliser l'objet &d{item}&c sur &b{block}&c." 27 | permission-interact-item-entity="&cTu n'as pas la permission d'utiliser l'objet &d{item}&c sur &b{entity}&c." 28 | permission-inventory-open="&cTu n'as pas la permission de &6{player}&c d'ouvrir &d{block}&c." 29 | permission-item-drop="&cTu n'as pas la permission de &6{player}&c pour jeter l'objet &d{item}&c dans cette protection." 30 | permission-item-use="&cTu ne peut pas utiliser l'objet &d{item}&c dans cette protection." 31 | permission-option-use="&cTu n'as pas la permission d'utiliser cette option." 32 | permission-override-deny="&cL'action que tu essayes d'effectuer a été refusée par un flag outrepassant administrateur." 33 | plugin-event-cancel="&cUn plug-in a annulé cette action." 34 | plugin-reload="&aGDHooks a été rechargé." 35 | trust-already-has="&c{target} a déjà la permission {type}&c." 36 | trust-grant="&aDonne à &6{target}&a la permission {type}&a dans la protection actuelle." 37 | trust-invalid="&cType de confiance invalide entré.\nLes types autorisés sont : accessor, builder, container, et manager." 38 | trust-no-claims="&cTu n'as pas de protection pour donner Confiance." 39 | trust-plugin-cancel="&cImpossible d'avoir Confiance en {target}&c. Un plug-in l'a refusé." 40 | trust-self="&cTu ne peut pas te faire Confiance à toi-même." 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/command/clan/CommandClanTrustRank.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.command.clan; 26 | 27 | import co.aikar.commands.BaseCommand; 28 | import co.aikar.commands.annotation.CommandAlias; 29 | import co.aikar.commands.annotation.CommandCompletion; 30 | import co.aikar.commands.annotation.CommandPermission; 31 | import co.aikar.commands.annotation.Description; 32 | import co.aikar.commands.annotation.Subcommand; 33 | import co.aikar.commands.annotation.Syntax; 34 | 35 | import org.bukkit.entity.Player; 36 | 37 | import com.google.common.collect.ImmutableMap; 38 | import com.griefdefender.api.Clan; 39 | import com.griefdefender.api.ClanPlayer; 40 | import com.griefdefender.api.GriefDefender; 41 | import com.griefdefender.api.claim.TrustType; 42 | import com.griefdefender.hooks.GDHooks; 43 | import com.griefdefender.hooks.config.ClanConfig; 44 | import com.griefdefender.hooks.config.MessageConfig; 45 | import com.griefdefender.hooks.permission.GDHooksPermissions; 46 | import com.griefdefender.hooks.util.HooksUtil; 47 | 48 | import com.griefdefender.lib.kyori.adventure.audience.Audience; 49 | import com.griefdefender.lib.kyori.adventure.text.Component; 50 | 51 | @CommandAlias("gdhooks") 52 | @CommandPermission(GDHooksPermissions.COMMAND_TRUST_RANK) 53 | public class CommandClanTrustRank extends BaseCommand { 54 | 55 | @CommandCompletion("@gdclanranks @gdtrusttypes @gddummy") 56 | @CommandAlias("clantrustrank") 57 | @Description("%clan-trust-rank") 58 | @Syntax(" ") 59 | @Subcommand("clan trust rank") 60 | public void execute(Player player, String rank, String type) { 61 | final Audience audience = GriefDefender.getAudienceProvider().getSender(player); 62 | TrustType trustType = HooksUtil.getTrustType(type); 63 | if (trustType == null) { 64 | audience.sendMessage(MessageConfig.MESSAGE_DATA.getMessage(MessageConfig.TRUST_INVALID)); 65 | return; 66 | } 67 | 68 | final ClanPlayer clanPlayer = GDHooks.getInstance().getClanProvider().getClanPlayer(player.getUniqueId()); 69 | if (clanPlayer == null) { 70 | return; 71 | } 72 | final Clan clan = clanPlayer.getClan(); 73 | if (clan == null) { 74 | return; 75 | } 76 | 77 | if (!clanPlayer.isLeader()) { 78 | return; 79 | } 80 | 81 | final ClanConfig clanConfig = GDHooks.getInstance().getClanConfigMap().get(clan.getTag()); 82 | if (clanConfig == null) { 83 | return; 84 | } 85 | clanConfig.getData().addRankTrust(rank, trustType); 86 | clanConfig.save(); 87 | final Component message = MessageConfig.MESSAGE_DATA.getMessage(MessageConfig.CLAN_TRUST_RANK, ImmutableMap.of( 88 | "rank", rank, 89 | "type", trustType.getName())); 90 | audience.sendMessage(message); 91 | } 92 | } -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/guilds/GDClanPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.guilds; 26 | 27 | import java.util.UUID; 28 | 29 | import org.checkerframework.checker.nullness.qual.Nullable; 30 | 31 | import com.griefdefender.api.Clan; 32 | import com.griefdefender.api.ClanPlayer; 33 | import com.griefdefender.api.GriefDefender; 34 | import com.griefdefender.api.User; 35 | import com.griefdefender.api.claim.Claim; 36 | import com.griefdefender.api.clan.Rank; 37 | import com.griefdefender.api.data.PlayerData; 38 | 39 | import me.glaremasters.guilds.Guilds; 40 | import me.glaremasters.guilds.guild.Guild; 41 | import me.glaremasters.guilds.guild.GuildMember; 42 | import me.glaremasters.guilds.guild.GuildRole; 43 | 44 | public class GDClanPlayer implements ClanPlayer { 45 | 46 | private GDClan clan; 47 | private final User user; 48 | 49 | public GDClanPlayer(Guild guild, UUID playerUniqueId) { 50 | this.clan = new GDClan(guild); 51 | this.user = GriefDefender.getCore().getUser(playerUniqueId); 52 | } 53 | 54 | @Override 55 | public UUID getUniqueId() { 56 | return this.user.getUniqueId(); 57 | } 58 | 59 | @Override 60 | public PlayerData getPlayerData() { 61 | return this.user.getPlayerData(); 62 | } 63 | 64 | @Override 65 | public boolean isOnline() { 66 | return this.user.isOnline(); 67 | } 68 | 69 | @Override 70 | public String getFriendlyName() { 71 | return this.user.getFriendlyName(); 72 | } 73 | 74 | @Override 75 | public String getIdentifier() { 76 | return this.user.getIdentifier(); 77 | } 78 | 79 | @Override 80 | public Clan getClan() { 81 | return this.clan; 82 | } 83 | 84 | @Override 85 | public @Nullable Object getOnlinePlayer() { 86 | return user.getOnlinePlayer(); 87 | } 88 | 89 | @Override 90 | public Rank getRank() { 91 | return this.getClan().getRank(this.getGuildMember().getRole().getName().toLowerCase()); 92 | } 93 | 94 | @Override 95 | public void setRank(Rank rank) { 96 | for (GuildRole role : Guilds.getApi().getGuildHandler().getRoles()) { 97 | if (role.getName().equalsIgnoreCase(rank.getName())) { 98 | this.getGuildMember().setRole(role); 99 | return; 100 | } 101 | } 102 | } 103 | 104 | @Override 105 | public @Nullable Claim getCurrentClaim() { 106 | return this.getPlayerData().getCurrentClaim(); 107 | } 108 | 109 | @Override 110 | public boolean isLeader() { 111 | return this.clan.getInternalClan().getGuildMaster().getUuid().equals(this.getUniqueId()); 112 | } 113 | 114 | public GuildMember getGuildMember() { 115 | return this.clan.getInternalClan().getMember(this.getUniqueId()); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/towny/GDClanPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.towny; 26 | 27 | import java.util.UUID; 28 | 29 | import org.checkerframework.checker.nullness.qual.Nullable; 30 | 31 | import com.griefdefender.api.Clan; 32 | import com.griefdefender.api.ClanPlayer; 33 | import com.griefdefender.api.GriefDefender; 34 | import com.griefdefender.api.User; 35 | import com.griefdefender.api.claim.Claim; 36 | import com.griefdefender.api.clan.Rank; 37 | import com.griefdefender.api.data.PlayerData; 38 | import com.griefdefender.hooks.GDHooks; 39 | import com.palmergames.bukkit.towny.object.Resident; 40 | 41 | public class GDClanPlayer implements ClanPlayer { 42 | 43 | private final Resident pluginClanPlayer; 44 | private final User user; 45 | 46 | public GDClanPlayer(Resident clanPlayer) { 47 | this.pluginClanPlayer = clanPlayer; 48 | this.user = GriefDefender.getCore().getUser(clanPlayer.getUUID()); 49 | } 50 | 51 | @Override 52 | public UUID getUniqueId() { 53 | return this.pluginClanPlayer.getUUID(); 54 | } 55 | 56 | @Override 57 | public PlayerData getPlayerData() { 58 | return this.user.getPlayerData(); 59 | } 60 | 61 | @Override 62 | public boolean isOnline() { 63 | return this.user.isOnline(); 64 | } 65 | 66 | @Override 67 | public String getFriendlyName() { 68 | return this.user.getFriendlyName(); 69 | } 70 | 71 | @Override 72 | public String getIdentifier() { 73 | return this.user.getIdentifier(); 74 | } 75 | 76 | @Override 77 | public Clan getClan() { 78 | final com.palmergames.bukkit.towny.object.Town town = this.getTown(); 79 | if (town == null) { 80 | return null; 81 | } 82 | return GDHooks.getInstance().getClanProvider().getClan(town.getName()); 83 | } 84 | 85 | @Override 86 | public @Nullable Object getOnlinePlayer() { 87 | return user.getOnlinePlayer(); 88 | } 89 | 90 | @Override 91 | public @Nullable Claim getCurrentClaim() { 92 | return this.getPlayerData().getCurrentClaim(); 93 | } 94 | 95 | @Override 96 | public boolean isLeader() { 97 | return this.pluginClanPlayer.isMayor(); 98 | } 99 | 100 | public com.palmergames.bukkit.towny.object.Town getTown() { 101 | com.palmergames.bukkit.towny.object.Town town = null; 102 | try { 103 | town = this.pluginClanPlayer.getTown(); 104 | } catch (Throwable t) { 105 | } 106 | return town; 107 | } 108 | 109 | @Override 110 | public void setRank(Rank rankName) { 111 | // TODO Auto-generated method stub 112 | 113 | } 114 | 115 | @Override 116 | public Rank getRank() { 117 | // TODO Auto-generated method stub 118 | return null; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/event/GDClaimEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.event; 26 | 27 | import com.google.common.collect.ImmutableList; 28 | import com.griefdefender.api.GriefDefender; 29 | import com.griefdefender.api.User; 30 | import com.griefdefender.api.claim.Claim; 31 | import com.griefdefender.api.event.ClaimEvent; 32 | import com.griefdefender.api.event.EventCause; 33 | 34 | import com.griefdefender.lib.kyori.adventure.text.Component; 35 | 36 | import java.util.List; 37 | import java.util.Optional; 38 | 39 | import org.bukkit.OfflinePlayer; 40 | import org.checkerframework.checker.nullness.qual.Nullable; 41 | 42 | public class GDClaimEvent implements ClaimEvent { 43 | 44 | private List claims; 45 | private Component message; 46 | private boolean isCancelled = false; 47 | private final Object source; 48 | private final User user; 49 | private final EventCause cause; 50 | 51 | public GDClaimEvent(Object source, Claim claim) { 52 | this.source = source; 53 | this.claims = ImmutableList.of(claim); 54 | this.cause = EventCause.of(GriefDefender.getEventManager().getCauseStackManager().getCurrentCause().root()); 55 | if (source instanceof User) { 56 | this.user = (User) source; 57 | } else if (source instanceof OfflinePlayer) { 58 | this.user = GriefDefender.getCore().getUser(((OfflinePlayer) source).getUniqueId()); 59 | } else { 60 | this.user = null; 61 | } 62 | } 63 | 64 | public GDClaimEvent(Object source, List claims) { 65 | this.source = source; 66 | this.claims = ImmutableList.copyOf(claims); 67 | this.cause = EventCause.of(GriefDefender.getEventManager().getCauseStackManager().getCurrentCause().root()); 68 | if (source instanceof User) { 69 | this.user = (User) source; 70 | } else if (source instanceof OfflinePlayer) { 71 | this.user = GriefDefender.getCore().getUser(((OfflinePlayer) source).getUniqueId()); 72 | } else { 73 | this.user = null; 74 | } 75 | } 76 | 77 | public boolean cancelled() { 78 | return this.isCancelled; 79 | } 80 | 81 | public void cancelled(boolean cancel) { 82 | this.isCancelled = cancel; 83 | } 84 | 85 | public Claim getClaim() { 86 | return this.getClaims().get(0); 87 | } 88 | 89 | @Override 90 | public List getClaims() { 91 | return this.claims; 92 | } 93 | 94 | @Override 95 | public void setMessage(Component message) { 96 | this.message = message; 97 | } 98 | 99 | @Override 100 | public Optional getMessage() { 101 | return Optional.ofNullable(this.message); 102 | } 103 | 104 | @Override 105 | public EventCause getCause() { 106 | return this.cause; 107 | } 108 | 109 | @Override 110 | public Object getSource() { 111 | return this.source; 112 | } 113 | 114 | @Override 115 | public @Nullable User getSourceUser() { 116 | return this.user; 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/uclans/GDClanPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.uclans; 26 | 27 | import java.util.UUID; 28 | 29 | import org.bukkit.Bukkit; 30 | import org.checkerframework.checker.nullness.qual.Nullable; 31 | 32 | import com.griefdefender.api.Clan; 33 | import com.griefdefender.api.ClanPlayer; 34 | import com.griefdefender.api.GriefDefender; 35 | import com.griefdefender.api.User; 36 | import com.griefdefender.api.claim.Claim; 37 | import com.griefdefender.api.clan.Rank; 38 | import com.griefdefender.api.data.PlayerData; 39 | import com.griefdefender.hooks.GDHooks; 40 | 41 | import me.ulrich.clans.interfaces.UClans; 42 | 43 | public class GDClanPlayer implements ClanPlayer { 44 | 45 | private final UClans plugin; 46 | private final me.ulrich.clans.data.PlayerData pluginClanPlayer; 47 | private final User user; 48 | 49 | public GDClanPlayer(me.ulrich.clans.data.PlayerData clanPlayer) { 50 | this.plugin = (UClans) Bukkit.getPluginManager().getPlugin("UltimateClans"); 51 | this.pluginClanPlayer = clanPlayer; 52 | this.user = GriefDefender.getCore().getUser(clanPlayer.getUuid()); 53 | } 54 | 55 | @Override 56 | public UUID getUniqueId() { 57 | return this.pluginClanPlayer.getUuid(); 58 | } 59 | 60 | @Override 61 | public PlayerData getPlayerData() { 62 | return this.user.getPlayerData(); 63 | } 64 | 65 | @Override 66 | public boolean isOnline() { 67 | return this.user.isOnline(); 68 | } 69 | 70 | @Override 71 | public String getFriendlyName() { 72 | return this.user.getFriendlyName(); 73 | } 74 | 75 | @Override 76 | public String getIdentifier() { 77 | return this.user.getIdentifier(); 78 | } 79 | 80 | @Override 81 | public Clan getClan() { 82 | final me.ulrich.clans.data.ClanData clanData = this.plugin.getClanAPI().getClan(this.pluginClanPlayer.getClan_id()).orElse(null); 83 | if (clanData == null) { 84 | return null; 85 | } 86 | return GDHooks.getInstance().getClanProvider().getClan(clanData.getTag()); 87 | } 88 | 89 | @Override 90 | public @Nullable Object getOnlinePlayer() { 91 | return user.getOnlinePlayer(); 92 | } 93 | 94 | @Override 95 | public Rank getRank() { 96 | final String role = this.pluginClanPlayer.getRole(); 97 | if (role == null) { 98 | return null; 99 | } 100 | return this.getClan().getRank(role); 101 | } 102 | 103 | @Override 104 | public void setRank(Rank rank) { 105 | // 106 | } 107 | 108 | @Override 109 | public @Nullable Claim getCurrentClaim() { 110 | return this.getPlayerData().getCurrentClaim(); 111 | } 112 | 113 | @Override 114 | public boolean isLeader() { 115 | final me.ulrich.clans.data.ClanData clanData = this.plugin.getClanAPI().getClan(this.pluginClanPlayer.getClan_id()).orElse(null); 116 | if (clanData == null) { 117 | return false; 118 | } 119 | return this.user.getUniqueId().equals(clanData.getLeader()); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/en_US.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | clan-trust="Grants a clan access to your claim.\nAccessor: access to interact with all blocks except inventory.\nContainer: access to interact with all blocks including inventory.\nBuilder: access to everything above including ability to place and break blocks.\nManager: access to everything above including ability to manage claim settings." 4 | clan-trust-all="Grants a clan access to ALL your claim(s).\nAccessor: access to interact with all blocks except inventory.\nContainer: access to interact with all blocks including inventory.\nBuilder: access to everything above including ability to place and break blocks.\nManager: access to everything above including ability to manage claim settings." 5 | clan-trust-rank="Grants a clan rank with a specific trust.\nAccessor: access to interact with all blocks except inventory.\nContainer: access to interact with all blocks including inventory.\nBuilder: access to everything above including ability to place and break blocks.\nManager: access to everything above including ability to manage claim settings." 6 | clan-untrust="Revokes clan access to your claim." 7 | clan-untrust-all="Revokes clan access to all your claims." 8 | clan-untrust-rank="Revokes a clan rank's trust to all your claims." 9 | version="Displays GDHooks version information." 10 | } 11 | messages { 12 | claim-disabled-world="&cClaims are disabled in this world." 13 | clan-rank-set-trust="&aSet rank &6{rank}&a to trust &d{type}." 14 | clan-rank-unset-trust="&aRemoved trust &d{type}&a from rank &6{rank}." 15 | command-invalid="&cNo valid command entered." 16 | command-invalid-amount="&cInvalid amount &6{amount}&c entered." 17 | command-invalid-claim="&cThis command cannot be used in {type}&c claims." 18 | command-invalid-clan="&cInvalid clan &6{clan}&c entered." 19 | command-invalid-group="&cGroup &6{group}&c is not valid." 20 | command-invalid-input="&cInvalid command input '{input}&c'." 21 | command-invalid-player="&cPlayer &6{player}&c is not valid." 22 | command-invalid-player-group="&cNot a valid player or group." 23 | command-invalid-type="&cInvalid type {type}&c specified." 24 | command-world-not-found="&cWorld '&6{world}&c' could not be found." 25 | permission-access="&cYou don't have &6{player}&c's permission to access that." 26 | permission-build="&cYou don't have &6{player}&c's permission to build." 27 | permission-build-near-claim="&cYou don't have &6{player}&c's permission to build near claim." 28 | permission-command-trust="&cYou don't have permission to use this type of trust." 29 | permission-edit-claim="&cYou don't have permission to edit this claim." 30 | permission-interact-block="&cYou don't have &6{player}'s &cpermission to interact with the block &d{block}&c." 31 | permission-interact-entity="&cYou don't have &6{player}'s &cpermission to interact with the entity &d{entity}&c." 32 | permission-interact-item="&cYou don't have &6{player}'s &cpermission to interact with the item &d{item}&c." 33 | permission-interact-item-block="&cYou don't have permission to use &d{item}&c on a &b{block}&c." 34 | permission-interact-item-entity="&cYou don't have permission to use &d{item}&c on a &b{entity}&c." 35 | permission-inventory-open="&cYou don't have &6{player}'s&c permission to open &d{block}&c." 36 | permission-item-drop="&cYou don't have &6{player}'s&c permission to drop the item &d{item}&c in this claim." 37 | permission-item-use="&cYou can't use the item &d{item}&c in this claim." 38 | permission-option-use="&cYou don't have permission to use this option." 39 | permission-override-deny="&cThe action you are attempting to perform has been denied by an administrator's override flag." 40 | plugin-event-cancel="&cA plugin has cancelled this action." 41 | plugin-reload="&aGDHooks has been reloaded." 42 | trust-already-has="&c{target} already has {type}&c permission." 43 | trust-grant="&aGranted &6{target}&a {type}&a permission in current claim." 44 | trust-invalid="&cInvalid trust type entered.\nThe allowed types are : accessor, builder, container, and manager." 45 | trust-no-claims="&cYou have no claims to trust." 46 | trust-plugin-cancel="&cCould not trust {target}&c. A plugin has denied it." 47 | trust-self="&cYou cannot trust yourself." 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/command/clan/CommandClanClaim.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.command.clan; 26 | 27 | import co.aikar.commands.BaseCommand; 28 | import co.aikar.commands.annotation.CommandAlias; 29 | import co.aikar.commands.annotation.CommandCompletion; 30 | import co.aikar.commands.annotation.CommandPermission; 31 | import co.aikar.commands.annotation.Description; 32 | import co.aikar.commands.annotation.Optional; 33 | import co.aikar.commands.annotation.Subcommand; 34 | import co.aikar.commands.annotation.Syntax; 35 | 36 | import org.bukkit.entity.Player; 37 | 38 | import com.google.common.collect.ImmutableMap; 39 | import com.griefdefender.api.Clan; 40 | import com.griefdefender.api.ClanPlayer; 41 | import com.griefdefender.api.CommandResult; 42 | import com.griefdefender.api.GriefDefender; 43 | import com.griefdefender.api.claim.Claim; 44 | import com.griefdefender.api.claim.TrustTypes; 45 | import com.griefdefender.hooks.GDHooks; 46 | import com.griefdefender.hooks.GDHooksAttributes; 47 | import com.griefdefender.hooks.config.MessageConfig; 48 | import com.griefdefender.hooks.permission.GDHooksPermissions; 49 | 50 | import com.griefdefender.lib.kyori.adventure.audience.Audience; 51 | import com.griefdefender.lib.kyori.adventure.text.Component; 52 | 53 | @CommandAlias("gdhooks") 54 | @CommandPermission(GDHooksPermissions.COMMAND_CLAN_CLAIM) 55 | public class CommandClanClaim extends BaseCommand { 56 | 57 | @CommandCompletion("@gdidentifiers") 58 | @CommandAlias("clanclaim") 59 | @Description("%clan-claim") 60 | @Syntax("[identifier]") 61 | @Subcommand("clan claim") 62 | public void execute(Player player, @Optional String identifier) { 63 | final ClanPlayer clanPlayer = GDHooks.getInstance().getClanProvider().getClanPlayer(player.getUniqueId()); 64 | if (clanPlayer == null) { 65 | return; 66 | } 67 | final Clan clan = clanPlayer.getClan(); 68 | if (clan == null) { 69 | return; 70 | } 71 | 72 | if (!clanPlayer.isLeader()) { 73 | return; 74 | } 75 | 76 | final Audience audience = GriefDefender.getAudienceProvider().getSender(player); 77 | final CommandResult result = GriefDefender.getCore().canUseCommand(player, TrustTypes.MANAGER, identifier); 78 | if (!result.successful()) { 79 | if (result.getClaim() != null) { 80 | final Component message = MessageConfig.MESSAGE_DATA.getMessage(MessageConfig.PERMISSION_TRUST, 81 | ImmutableMap.of( 82 | "owner", result.getClaim().getOwnerDisplayName())); 83 | audience.sendMessage(message); 84 | } else { 85 | audience.sendMessage(MessageConfig.MESSAGE_DATA.getMessage(MessageConfig.PERMISSION_COMMAND_TRUST)); 86 | } 87 | return; 88 | } 89 | 90 | final Claim claim = result.getClaim(); 91 | if (claim.hasAttribute(GDHooksAttributes.ATTRIBUTE_CLAN)) { 92 | claim.removeAttribute(GDHooksAttributes.ATTRIBUTE_CLAN); 93 | audience.sendMessage(Component.text("Removed clan attribute.")); 94 | } else { 95 | claim.addAttribute(GDHooksAttributes.ATTRIBUTE_CLAN); 96 | audience.sendMessage(Component.text("Added clan attribute.")); 97 | } 98 | } 99 | } -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/parties/GDClanPlayer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.parties; 26 | 27 | import com.alessiodp.parties.api.Parties; 28 | import com.alessiodp.parties.api.interfaces.Party; 29 | import com.alessiodp.parties.api.interfaces.PartyPlayer; 30 | import com.alessiodp.parties.api.interfaces.PartyRank; 31 | import com.griefdefender.api.Clan; 32 | import com.griefdefender.api.ClanPlayer; 33 | import com.griefdefender.api.GriefDefender; 34 | import com.griefdefender.api.User; 35 | import com.griefdefender.api.claim.Claim; 36 | import com.griefdefender.api.clan.Rank; 37 | import com.griefdefender.api.data.PlayerData; 38 | import org.checkerframework.checker.nullness.qual.Nullable; 39 | 40 | import java.util.UUID; 41 | 42 | public class GDClanPlayer implements ClanPlayer { 43 | 44 | private final GDClan clan; 45 | private final Party pluginParty; 46 | private final User user; 47 | 48 | public GDClanPlayer(Party party, UUID playerUniqueId) { 49 | this.clan = new GDClan(party); 50 | this.pluginParty = party; 51 | this.user = GriefDefender.getCore().getUser(playerUniqueId); 52 | } 53 | 54 | @Override 55 | public UUID getUniqueId() { 56 | return this.user.getUniqueId(); 57 | } 58 | 59 | @Override 60 | public PlayerData getPlayerData() { 61 | return this.user.getPlayerData(); 62 | } 63 | 64 | @Override 65 | public boolean isOnline() { 66 | return this.user.isOnline(); 67 | } 68 | 69 | @Override 70 | public String getFriendlyName() { 71 | return this.user.getFriendlyName(); 72 | } 73 | 74 | @Override 75 | public String getIdentifier() { 76 | return this.user.getIdentifier(); 77 | } 78 | 79 | @Override 80 | public Clan getClan() { 81 | return this.clan; 82 | } 83 | 84 | @Override 85 | public @Nullable Object getOnlinePlayer() { 86 | return user.getOnlinePlayer(); 87 | } 88 | 89 | @Override 90 | public Rank getRank() { 91 | PartyPlayer partyPlayer = Parties.getApi().getPartyPlayer(getUniqueId()); 92 | if (partyPlayer != null) { 93 | PartyRank rank = Parties.getApi().getRanks().stream().filter(r -> r.getLevel() == partyPlayer.getRank()).findFirst().orElse(null); 94 | return rank != null ? this.getClan().getRank(rank.getName().toLowerCase()) : null; 95 | } 96 | return null; 97 | } 98 | 99 | @Override 100 | public void setRank(Rank rank) { 101 | for (PartyRank r : Parties.getApi().getRanks()) { 102 | if (r.getConfigName().equalsIgnoreCase(rank.getName())) { 103 | PartyPlayer partyPlayer = Parties.getApi().getPartyPlayer(getUniqueId()); 104 | if (partyPlayer != null) 105 | partyPlayer.setRank(r.getLevel()); 106 | return; 107 | } 108 | } 109 | } 110 | 111 | @Override 112 | public @Nullable Claim getCurrentClaim() { 113 | return this.getPlayerData().getCurrentClaim(); 114 | } 115 | 116 | @Override 117 | public boolean isLeader() { 118 | return this.pluginParty.getLeader() != null && this.pluginParty.getLeader().equals(this.getUniqueId()); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/category/ProviderCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config.category; 26 | 27 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 28 | import org.spongepowered.configurate.objectmapping.meta.Setting; 29 | 30 | @ConfigSerializable 31 | public class ProviderCategory extends ConfigCategory { 32 | 33 | // Shop Plugins 34 | @Setting(value = "BossShopPro") 35 | public boolean bossShopPro = true; 36 | 37 | @Setting(value = "ChestShop") 38 | public boolean chestShop = true; 39 | 40 | @Setting(value = "DynamicShop") 41 | public boolean dynamicShop = true; 42 | 43 | @Setting(value = "InsaneShops") 44 | public boolean insaneShops = true; 45 | 46 | @Setting(value = "QuickShop") 47 | public boolean quickShop = true; 48 | 49 | @Setting(value = "QuickShop-Hikari") 50 | public boolean quickShopHikari = true; 51 | 52 | @Setting(value = "ShopChest") 53 | public boolean shopChest = true; 54 | 55 | @Setting(value = "Shop") 56 | public boolean shop = true; 57 | 58 | @Setting(value = "Slabbo") 59 | public boolean slabbo = true; 60 | 61 | @Setting(value = "TradeShop") 62 | public boolean tradeShop = true; 63 | 64 | @Setting(value = "UltimateShops") 65 | public boolean ultimateShops = true; 66 | 67 | // Misc 68 | 69 | @Setting(value = "AureliumSkills") 70 | public boolean aureliumSkills = true; 71 | 72 | @Setting(value = "CustomItems") 73 | public boolean customItems = true; 74 | 75 | @Setting(value = "EliteMobs") 76 | public boolean eliteMobs = true; 77 | 78 | @Setting(value = "ExcellentCratesProvider") 79 | public boolean excellentCratesProvider = true; 80 | 81 | @Setting(value = "FurnitureLib") 82 | public boolean furnitureLib = true; 83 | 84 | @Setting(value = "Guilds") 85 | public boolean guilds = true; 86 | 87 | @Setting(value = "ItemsAdder") 88 | public boolean itemsAdder = true; 89 | 90 | @Setting(value = "Oraxen") 91 | public boolean oraxen = true; 92 | 93 | @Setting(value = "Parties") 94 | public boolean parties = true; 95 | 96 | @Setting(value = "RevoltCrates") 97 | public boolean revoltCrates = true; 98 | 99 | @Setting(value = "SimpleClans") 100 | public boolean simpleClans = true; 101 | 102 | @Setting(value = "UltimateClans") 103 | public boolean ultimateClans = true; 104 | 105 | @Setting(value = "McMMO") 106 | public boolean mcMMO = true; 107 | 108 | @Setting(value = "MMOItems") 109 | public boolean mmoItems = true; 110 | 111 | @Setting(value = "MyPet") 112 | public boolean myPet = true; 113 | 114 | @Setting(value = "MythicMobs") 115 | public boolean mythicMobs = true; 116 | 117 | @Setting(value = "Nova") 118 | public boolean nova = true; 119 | 120 | @Setting(value = "OreRegenerator") 121 | public boolean oreRegenerator = true; 122 | 123 | @Setting(value = "Towny") 124 | public boolean towny = true; 125 | 126 | // Map 127 | @Setting(value = "BlueMap") 128 | public boolean bluemap = true; 129 | 130 | @Setting(value = "Dynmap") 131 | public boolean dynmap = true; 132 | 133 | @Setting(value = "Squaremap") 134 | public boolean squaremap = true; 135 | 136 | } 137 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/ClanConfigData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 31 | import org.spongepowered.configurate.objectmapping.meta.Comment; 32 | import org.spongepowered.configurate.objectmapping.meta.Setting; 33 | 34 | import com.griefdefender.api.GriefDefender; 35 | import com.griefdefender.api.claim.TrustType; 36 | import com.griefdefender.api.claim.TrustTypes; 37 | import com.griefdefender.hooks.config.category.ConfigCategory; 38 | 39 | @ConfigSerializable 40 | public class ClanConfigData extends ConfigCategory { 41 | 42 | @Setting(value = "rank-trust-map") 43 | @Comment(value = "A clan rank to trust map allowing clan leaders to manage trust per rank. \nNote: Trust applies to all claims owned by clan.") 44 | public Map clanRankTrustMap = new HashMap<>(); 45 | 46 | @Setting(value = "ally-trust-map") 47 | @Comment(value = "A clan ally trust map allowing clan leaders to manage trust per ally. \nNote: Trust applies to all claims owned by clan.") 48 | public Map clanAllyTrustMap = new HashMap<>(); 49 | 50 | public ClanConfigData() { 51 | 52 | } 53 | 54 | public Map getRankTrustMap() { 55 | return this.clanRankTrustMap; 56 | } 57 | 58 | public Map getAllyTrustMap() { 59 | return this.clanAllyTrustMap; 60 | } 61 | 62 | public TrustType getRankTrust(String rank) { 63 | if (rank == null || rank.isEmpty()) { 64 | return TrustTypes.ACCESSOR; 65 | } 66 | 67 | final String trust = this.clanRankTrustMap.get(rank.toLowerCase()); 68 | if (trust == null) { 69 | return TrustTypes.ACCESSOR; 70 | } 71 | try { 72 | return GriefDefender.getRegistry().getType(TrustType.class, trust).orElse(TrustTypes.ACCESSOR); 73 | } catch (Throwable t) { 74 | t.printStackTrace(); 75 | } 76 | return TrustTypes.ACCESSOR; 77 | } 78 | 79 | public void addRankTrust(String rank, TrustType trustType) { 80 | this.clanRankTrustMap.put(rank.toLowerCase(), trustType.getName().toLowerCase()); 81 | } 82 | 83 | public void deleteRankTrust(String rank) { 84 | this.clanRankTrustMap.remove(rank.toLowerCase()); 85 | } 86 | 87 | public TrustType getAllyTrust(String clanTag) { 88 | if (clanTag == null || clanTag.isEmpty()) { 89 | return TrustTypes.ACCESSOR; 90 | } 91 | 92 | final String trust = this.clanAllyTrustMap.get(clanTag.toLowerCase()); 93 | if (trust == null) { 94 | return TrustTypes.ACCESSOR; 95 | } 96 | try { 97 | return GriefDefender.getRegistry().getType(TrustType.class, trust).orElse(TrustTypes.ACCESSOR); 98 | } catch (Throwable t) { 99 | t.printStackTrace(); 100 | } 101 | return TrustTypes.ACCESSOR; 102 | } 103 | 104 | public void addAllyTrust(String clanTag, TrustType trustType) { 105 | this.clanAllyTrustMap.put(clanTag.toLowerCase(), trustType.getName().toLowerCase()); 106 | } 107 | 108 | public void deleteAllyTrust(String clanTag) { 109 | this.clanAllyTrustMap.remove(clanTag.toLowerCase()); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /bukkit/loader/src/main/resources/assets/lang/es_ES.conf: -------------------------------------------------------------------------------- 1 | GDHooks { 2 | descriptions { 3 | trust-clan="Concede a un CLAN acceso a un Claim de tu propiedad.\nACCESIBILIDAD: Acceso para interactuar con todos los bloques execpto con los contededores.\nCONTENEDORES: Acceso para interactuar con todos los bloques incluyendo con los contededores.\nCONSTRUCCION: Acceso a todo lo de arriba incluyendo la habilidad de romper y colocar bloques.\nADMINISTRAR: acceso a todo lo de arriba incluyendo derechos para configurar las opciones del Claim." 4 | trust-clan-all="Concede a un CLAN acceso a TODOS los Claims de tu propiedad.\nACCESIBILIDAD: Acceso para interactuar con todos los bloques execpto con los contededores.\nCONTENEDORES: Acceso para interactuar con todos los bloques incluyendo con los contededores.\nCONSTRUCCION: Acceso a todo lo de arriba incluyendo la habilidad de romper y colocar bloques.\nADMINISTRAR: acceso a todo lo de arriba incluyendo derechos para configurar las opciones del Claim." 5 | untrust-clan="Deniega a un CLAN el acceso a tu Claim." 6 | untrust-clan-all="Deniega a un CLAN el acceso a TODOS tus Claims." 7 | version="Muestra información sobre la versión y más caracteristicas de GDHooks." 8 | } 9 | messages { 10 | claim-disabled-world="&4&l[ERROR] &cLos Claims en este mundo han sido desactivados." 11 | command-invalid="&4&l[ERROR] &cNo se ha encontrado ningún comando válido." 12 | command-invalid-claim="&4&l[ERROR] &cEste comando no puede ser usado en Claims de tipo &l➜ {type}&c." 13 | command-invalid-group="&4&l[ERROR] &cEl grupo &6&o'{group}'&c NO es válido." 14 | command-invalid-input="&4&l[ERROR] &cEntrada de comando inválida: '{input}&c'." 15 | command-invalid-player="&4&l[ERROR] &cEl jugador &6&o'{player}'&c NO es válido." 16 | command-invalid-player-group="&4&l[ERROR] &cJugador o Grupo NO válidos." 17 | command-invalid-type="&4&l[ERROR] &cTipo especificado: {type}&c &l➜ INVALIDO." 18 | command-world-not-found="&4&l[ERROR] &cMundo ➜ &6&o'{world}'&c ➜ &lNO ENCONTRADO" 19 | permission-access="&4&l[ERROR] &6&o{player} &cNo tienes los permisos para acceder a eso." 20 | permission-build="&4&l[PERMISO-DENEGADO] &cNo tienes permiso para construir." 21 | permission-build-near-claim="&4&l[PERMISO-DENEGADO] &6&o{player} &cno puedes construir cerca de un terreno." 22 | permission-command-trust="&4&l[PERMISO-DENEGADO] &cNo puedes &nusar&c este tipo de Privilegio." 23 | permission-edit-claim="&4&l[PERMISO-DENEGADO] &cNo puedes &neditar&c este terreno." 24 | permission-interact-block="&4&l[PERMISO-DENEGADO] &c➜ &cNo tienes el permiso de &6&o{player} &cpara interactuar con el bloque ➜ &6&o'{block}'" 25 | permission-interact-entity="&4&l[PERMISO-DENEGADO] &c➜ &cNo tienes el permiso de &6&o{player} &cpara interactuar con la entidad ➜ &6&o'{entity}'" 26 | permission-interact-item="&4&l[PERMISO-DENEGADO] &c➜ &cNo tienes el permiso de &6&o{player} &cpara interactuar con el objeto ➜ &6&o{item}" 27 | permission-interact-item-block="&4&l[PERMISO-DENEGADO] &4&lNO &cpuedes usar el Objeto &6&o{item}&c en el bloque &6&o'{block}'" 28 | permission-interact-item-entity="&4&l[PERMISO-DENEGADO] &4&lNO &cpuedes usar el Objeto &6&o{item}&c en la entidad &6&o'{entity}'" 29 | permission-inventory-open="&4&l[PERMISO-DENEGADO] &c➜ &6&o{player} &4&lNO&c puedes abrir ➜ &6&o'{block}'" 30 | permission-item-drop="&4&l[PERMISO-DENEGADO] &c➜ &6&o{player} &4&lNO&c puedes dropear el Objeto &6&o'{item}'&c en este terreno." 31 | permission-item-use="&4&l[PERMISO-DENEGADO] &c&lNO &cpuedes usar en este terreno el Objeto ➜ &6&o'{item}'" 32 | permission-option-use="&4&l[PERMISO-DENEGADO] &cNo puedes &nusar&c esta Opción." 33 | permission-override-deny="&4&l[ACCION-DENEGADA] &cLa que estás intentado hacer ha sido ignorado por un Flag de Administración." 34 | plugin-event-cancel="[ACCION-CANCELADA] &cUn Plugin ha cancelado esta acción." 35 | plugin-reload="&b&l[&3&lGD&b&l-&f&lHOOKS&b&l] &a&lha sido re-cargado. &aTodas las configuraciones han sido &2&lACTUALIZADAS." 36 | trust-already-has="&6&o{target} &cya tiene el permiso de tipo &6&o{type}&c." 37 | trust-grant="&aSe le ha dado a &6{target}&a el permiso {type}&a en la claim actual." 38 | trust-invalid="&4&l[ERROR] &cIntroducido tipo de permiso de Confianza inválido.\n&cTIPOS PERMITIDOS: &6&oaccessor, builder, container y manager." 39 | trust-no-claims="&4&l[ERROR] &cNo tienes terrenos para confiar a alguien." 40 | trust-plugin-cancel="&4&l[ERROR] &cNo puedes confiar a &6&o{target}&c. Un plugin lo ha denegado." 41 | trust-self="&4&l[ERROR] &cNo puedes darte permisos de Confianza a ti mismo." 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/provider/clan/simpleclans/SimpleClanProtectionProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.provider.clan.simpleclans; 26 | 27 | import java.util.Collections; 28 | import java.util.HashSet; 29 | import java.util.Set; 30 | import java.util.UUID; 31 | 32 | import org.bukkit.Location; 33 | import org.bukkit.OfflinePlayer; 34 | import org.bukkit.World; 35 | import org.bukkit.entity.Player; 36 | import org.bukkit.event.Event; 37 | import org.jetbrains.annotations.NotNull; 38 | import org.jetbrains.annotations.Nullable; 39 | 40 | import com.griefdefender.api.GriefDefender; 41 | import com.griefdefender.api.claim.Claim; 42 | import com.griefdefender.api.claim.ClaimManager; 43 | 44 | import net.sacredlabyrinth.phaed.simpleclans.hooks.protection.Land; 45 | import net.sacredlabyrinth.phaed.simpleclans.hooks.protection.ProtectionProvider; 46 | 47 | public class SimpleClanProtectionProvider implements ProtectionProvider { 48 | 49 | @Override 50 | public void setup() { 51 | } 52 | 53 | @Override 54 | public @NotNull Set getLandsAt(@NotNull Location location) { 55 | final Claim claim = GriefDefender.getCore().getClaimAt(location); 56 | if (claim == null) { 57 | return Collections.emptySet(); 58 | } 59 | return Collections.singleton(getLand(claim)); 60 | } 61 | 62 | @Nullable 63 | private Land getLand(@Nullable Claim claim) { 64 | if (claim == null) { 65 | return null; 66 | } 67 | return new Land(claim.getUniqueId().toString(), Collections.singleton(claim.getOwnerUniqueId())); 68 | } 69 | 70 | @Override 71 | public @NotNull Set getLandsOf(@NotNull OfflinePlayer player, @NotNull World world) { 72 | HashSet lands = new HashSet<>(); 73 | for (Claim claim : GriefDefender.getCore().getPlayerData(world.getUID(), player.getUniqueId()).getClaims()) { 74 | if (claim == null) { 75 | continue; 76 | } 77 | lands.add(getLand(claim)); 78 | } 79 | return lands; 80 | } 81 | 82 | @Override 83 | public @NotNull String getIdPrefix() { 84 | return "gd"; 85 | } 86 | 87 | @Override 88 | public void deleteLand(@NotNull String id, @NotNull World world) { 89 | final ClaimManager claimManager = GriefDefender.getCore().getClaimManager(world.getUID()); 90 | UUID uuid = null; 91 | try { 92 | uuid = UUID.fromString(id); 93 | } catch (IllegalArgumentException e) { 94 | return; 95 | } 96 | final Claim claim = claimManager.getClaimByUUID(uuid); 97 | if (claim != null) { 98 | claimManager.deleteClaim(claim, false); 99 | } 100 | } 101 | 102 | @Override 103 | public @Nullable Class getCreateLandEvent() { 104 | return CreateClaimBukkitEvent.class; 105 | } 106 | 107 | @Override 108 | public @Nullable Player getPlayer(Event event) { 109 | if (!(event instanceof CreateClaimBukkitEvent)) { 110 | return null; 111 | } 112 | 113 | final CreateClaimBukkitEvent createEvent = (CreateClaimBukkitEvent) event; 114 | return createEvent.getCreator(); 115 | } 116 | 117 | @Override 118 | public @Nullable String getRequiredPluginName() { 119 | return "GriefDefender"; 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/griefdefender/hooks/config/category/SquaremapCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of GDHooks, 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 com.griefdefender.hooks.config.category; 26 | 27 | import java.util.HashMap; 28 | import java.util.Map; 29 | 30 | import org.spongepowered.configurate.objectmapping.ConfigSerializable; 31 | import org.spongepowered.configurate.objectmapping.meta.Comment; 32 | import org.spongepowered.configurate.objectmapping.meta.Setting; 33 | 34 | import com.griefdefender.api.GriefDefender; 35 | import com.griefdefender.api.claim.ClaimType; 36 | import com.griefdefender.api.claim.ClaimTypes; 37 | 38 | @ConfigSerializable 39 | public class SquaremapCategory { 40 | 41 | @Setting("enabled") 42 | @Comment("Set to true to enable GriefDefender Squaremap integration. (Default: true)") 43 | public boolean enabled = true; 44 | 45 | @Setting("control-label") 46 | @Comment("The control bar label") 47 | public String control_label = "GriefDefender"; 48 | 49 | @Setting("control-show") 50 | @Comment("The control bar label") 51 | public boolean control_show = true; 52 | 53 | @Setting("control-hide") 54 | @Comment("The control bar label") 55 | public boolean control_hide = false; 56 | 57 | @Setting("update-interval") 58 | @Comment("The interval between update claims draw") 59 | public int UPDATE_INTERVAL = 300; 60 | 61 | @Setting("claimtype-styles") 62 | public Map claimTypeStyles = new HashMap<>(); 63 | 64 | @Setting("owner-styles") 65 | public Map ownerStyles = new HashMap<>(); 66 | 67 | @Setting("claim-tooltip") 68 | public String CLAIM_TOOLTIP = "Name: %claimname%
" 69 | + "Owner: %owner%
" 70 | + "OwnerUUID: %owneruuid%
" 71 | + "Type: %gdtype%
" 72 | + "Last Seen: %lastseen%
" 73 | + "Manager Trust: %managers%
" 74 | + "Builder Trust: %builders%
" 75 | + "Container Trust: %containers%
" 76 | + "Resident Trust: %residents%" 77 | + "Access Trust: %accessors%"; 78 | 79 | @Setting("claim-tooltip-admin") 80 | public String ADMIN_CLAIM_TOOLTIP = "%claimname%
" 81 | + "Manager Trust: %managers%
" 82 | + "Builder Trust: %builders%
" 83 | + "Container Trust: %containers%
" 84 | + "Resident Trust: %residents% " 85 | + "Access Trust: %accessors% "; 86 | 87 | public SquaremapCategory() { 88 | for (ClaimType type : GriefDefender.getRegistry().getAllOf(ClaimType.class)) { 89 | if (type == ClaimTypes.WILDERNESS) { 90 | continue; 91 | } 92 | if (this.claimTypeStyles.get(type.getName().toLowerCase()) == null) { 93 | this.claimTypeStyles.put(type.getName().toLowerCase(), new SquaremapOwnerStyleCategory(type)); 94 | } 95 | } 96 | } 97 | } 98 | --------------------------------------------------------------------------------