GriefDefender/bukkit/src/main/java/com/griefdefender/command/CommandRestoreNature.java

70 lines
3.1 KiB
Java
Raw Normal View History

2019-07-24 05:31:17 +02:00
/*
* This file is part of GriefDefender, licensed under the MIT License (MIT).
*
* Copyright (c) bloodmc
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.griefdefender.command;
import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import co.aikar.commands.annotation.Description;
import co.aikar.commands.annotation.Subcommand;
import com.google.common.collect.ImmutableMap;
2019-07-24 05:31:17 +02:00
import com.griefdefender.GDPlayerData;
import com.griefdefender.GriefDefenderPlugin;
import com.griefdefender.api.claim.ShovelTypes;
import com.griefdefender.cache.MessageCache;
import com.griefdefender.configuration.MessageStorage;
2019-07-24 05:31:17 +02:00
import com.griefdefender.internal.util.NMSUtil;
import com.griefdefender.permission.GDPermissions;
import net.kyori.text.TextComponent;
import net.kyori.text.adapter.bukkit.TextAdapter;
import net.kyori.text.format.TextColor;
import org.bukkit.entity.Player;
@CommandAlias("%griefdefender")
@CommandPermission(GDPermissions.COMMAND_RESTORE_NATURE)
public class CommandRestoreNature extends BaseCommand {
@CommandAlias("modenature")
Update for 1.5.5 release. * Add potion effects support. * Add item enchantment support. * Add pvp lookup methods for claim and playerdata. * Add 'block-tileentity-id-list' used to override mod block id's that are used for many TE's. - Ex. IC2 uses a base block id 'ic2:te' for all TE's. When the id is detected during block/item usage, it will be converted to the actual id. * Add TileEntity registry to better support hybrid servers. * Add '/claiminfo' UUID click support to copy text to chat. * Add support for overriding option 'player-command-exit/enter' on player. * Add command description translation support. * Add zh_HK language support. * Fix event cause not clearing on push. * Fix abandon claim within town returning funds to owner in economy mode. * Fix player afk detection during claim block task. * Fix async chunk load during visual revert. * Fix '/gd claim we' command. * Fix advanced flag GUI toggle with definitions. * Fix rent sign update not checking all children claims. * Fix rent sign not being updated when cancelled via '/claimrent cancel'. * Fix '/claimsell' on admin claim. * Fix NPE when attempting to purchase an admin claim for sale. * Fix command description translations. * Fix isInvulnerable NPE on 1.8.8 servers. * Fix '/abandonworld' exiting when no economy data found for player. * Fix '/deletealladmin' only deleting admin claims in current world when passing no world argument. * Fix '/claimcontract' and '/claimexpand' NPE in economy mode. * Fix GD claim enter/exit prefix. The prefix will now use '[<playername>]'. Note: This can be configured in lang file under 'claim-prefix-enter' and 'claim-prefix-exit' * Clean up advanced flag GUI code. * Disable /buyblocks command when economy-block-cost is <= 0 * Deny town claim abandon if basic claims exist owned by owner. * Allow to input string as option value. * Improve pvp source contexts. * Clean up '/acb' command code. * (Bukkit) Add potion splash protection support. * (Bukkit) Fix tamed entities being hit by projectiles. * (Bukkit) Fix enderman block place protection. * (Hybrid) Fix wrong EnumCreatureType being registered for entities. * (Hybrid) Add TileEntity registry. * (Hybrid) Add mod command support for 'command-execute' flag. * (Sponge) Add PlaceHolderAPI support. * (Sponge) Add Nucleus v2 support. * (Sponge) Add IgniteEntityEvent support. * (Sponge) Fix '/cpp' and '/cpg' command. * (Sponge) Fix player block placement deny not sending message. Fixes #4 Fixes #200, Fixes #206, Fixes #222 Fixes #232, Fixes #237, Fixes #267 Fixes #269, Fixes #276, Fixes #296 Fixes #310, Fixes #311, Fixes #317 Fixes #324, Fixes #333, Fixes #334 Fixes #335, Fixes #336, Fixes #347
2020-12-28 23:28:12 +01:00
@Description("%mode-nature")
2019-07-24 05:31:17 +02:00
@Subcommand("mode nature")
public void execute(Player player) {
if (true) {
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().FEATURE_NOT_AVAILABLE);
2019-07-24 05:31:17 +02:00
return;
}
if (!NMSUtil.getInstance().hasItemInOneHand(player, GriefDefenderPlugin.getInstance().modificationTool)) {
TextAdapter.sendComponent(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.TOOL_NOT_EQUIPPED,
Update for 1.5.0 * Fix blockstate id lookup not using proper id when block data was different than actual block. * Fix block-break showing air as target when source block broke on its own. * Fix race condition when migrating GP Bukkit playerdata. * Fix race condition during flag definition saves. * Fix wrong owner showing in claim when non-owner changes claim type. * Fix explosions causing no sound when cancelling event. * Fix rent min message showing max. * Fix rent min payment not being applied as credit. * Fix rent restore not working on rent end. * Fix sell sign not working when rent system was disabled. * Fix '/abandonall' not giving all money back when using economy mode. * Fix '/claimsell' requiring for sale to be turned on. * Fix '/givepet' taming pets without owner. * Fix explosion sounds not triggering on cancel. * Fix pvp 'allow-fly' only affecting creative mode. * Fix confirmation message not showing after abandoning a subdivision. * Fix wrong location being checked when placing water/lava with bucket. * Fix dynmap owner style colors not being used. * Fix NPE when using /reload. * Fix ghost claim overlap error when creating claim. * Fix user showing up as cause when using rtp. * Fix high memory usage caused by GDClaimManager fastutil usage. * (Bukkit) Fix NPE during InventoryMoveItemEvent. * (Sponge) Fix explosion-surface being triggered with no settings. * Refactor CompletableFuture handling when applying LP permissions and meta to avoid race conditions. * Remove owner override context for flag definition 'fire-spread' as it doesn't affect global overrides. * Change flag definition 'turtle-egg-hatch' target from 'air' to 'turtle-egg-hatch' * Change flag definition 'snow-melt' target from 'air' to 'snow' * Change onPlayerInteractBlockSecondary event priority from lowest to low in order to support plugins that need to cancel early. * Add support for CustomItems. Any customitem used in game will show up in debug as customitems:<item_id>. You can also use customitems for modification and investigation tool in config. * Add support for Slimefun4. Any slimefun item/block used in game will show up in debug as slimefun:<id>. You can also use slimefun items for modification and investigation tool in config. * Add '/acball' command for adjusting all online players' bonus blocks. * Add '/claiminvestigate' command to investigate claims. * Add '/claimtool' to toggle claim tool usage. * Add source/target any contexts to flag definitions. * Add 'piston-protection-in-claims' setting to control piston protection within claims. * Add pvp setting 'combat-logout' to determine if a player should be killed on logout during combat. Default 'false'. * Add `projectile-impact-entity` to `endcrystal-use` flag definition. * Add aquatic target for `monster-animal-damage` flag definition. * Add `restrict-world-max-height` to determine if claiming should be restricted to world max height. Default 'true'. * Add ability to control dynmap color settings by claim type. * Add permission griefdefender.user.claim.command.info.teleport.inside which controls whether a player can ONLY teleport within the claim they are in. This is useful if players become trapped. Note: This does not allow players to teleport to any other claim except the one they are in. It can only be used if the player cannot build in claim. * Add permission griefdefender.user.claim.command.info.others.creation-date to control whether a player sees creation date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.last-active to control whether a player sees last active date in /claiminfo * Add permission griefdefender.user.claim.command.info.others.claim-uuid to control whether a player sees claim uuid in /claiminfo * All flag definitions will now persist. * Refresh player option cache on permission change. * Show TP info in '/claiminfo' when player does not have TP permission. * (Sponge) Use 'tnt' as identifier instead of 'primedtnt' to match bukkit. * (Sponge) Use 'item_frame' as identifier instead of 'itemframe' to match bukkit.
2020-08-16 06:39:38 +02:00
ImmutableMap.of("tool", TextComponent.of(GriefDefenderPlugin.getInstance().modificationTool.toLowerCase(), TextColor.GREEN))));
2019-07-24 05:31:17 +02:00
return;
}
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
playerData.shovelMode = ShovelTypes.RESTORE;
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().MODE_NATURE);
2019-07-24 05:31:17 +02:00
}
}