mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2025-01-07 19:38:56 +01:00
More fixes for 1.2.2 release.
* Fix claim inheritance. * Fix getPermissionValue not continuing after matching contexts. * Fix messages being sent to players during entity attacks. * Fix item frame protection. * Fix safe teleport being used for /claimspawn (temp fix) * Fix safe teleport ending above nether. * Fix PvP toggle not showing proper default value in /claiminfo. * Fix a few issues with option GUI. * Add /claimexpand <amount> [direction] and /claimcontract <amount> [direction] to resize claims without shovel. * Add support for VehicleMoveEvent. * Don't listen to InventoryOpenEvent. Handle inventory via interacts instead. * Reset claim visuals on resize. * Remove 'gd_claim_type' context as it is no longer needed.
This commit is contained in:
parent
9bcb2f265c
commit
4ca3d78709
@ -88,11 +88,13 @@
|
||||
import com.griefdefender.command.CommandClaimBuy;
|
||||
import com.griefdefender.command.CommandClaimBuyBlocks;
|
||||
import com.griefdefender.command.CommandClaimClear;
|
||||
import com.griefdefender.command.CommandClaimContract;
|
||||
import com.griefdefender.command.CommandClaimCuboid;
|
||||
import com.griefdefender.command.CommandClaimDelete;
|
||||
import com.griefdefender.command.CommandClaimDeleteAll;
|
||||
import com.griefdefender.command.CommandClaimDeleteAllAdmin;
|
||||
import com.griefdefender.command.CommandClaimDeleteTop;
|
||||
import com.griefdefender.command.CommandClaimExpand;
|
||||
import com.griefdefender.command.CommandClaimFarewell;
|
||||
import com.griefdefender.command.CommandClaimFlag;
|
||||
import com.griefdefender.command.CommandClaimFlagDebug;
|
||||
@ -567,11 +569,13 @@ public void registerBaseCommands() {
|
||||
manager.registerCommand(new CommandClaimBuy());
|
||||
manager.registerCommand(new CommandClaimBuyBlocks());
|
||||
manager.registerCommand(new CommandClaimClear());
|
||||
manager.registerCommand(new CommandClaimContract());
|
||||
manager.registerCommand(new CommandClaimCuboid());
|
||||
manager.registerCommand(new CommandClaimDelete());
|
||||
manager.registerCommand(new CommandClaimDeleteAll());
|
||||
manager.registerCommand(new CommandClaimDeleteAllAdmin());
|
||||
manager.registerCommand(new CommandClaimDeleteTop());
|
||||
manager.registerCommand(new CommandClaimExpand());
|
||||
manager.registerCommand(new CommandClaimFarewell());
|
||||
manager.registerCommand(new CommandClaimFlag());
|
||||
manager.registerCommand(new CommandClaimFlagDebug());
|
||||
@ -707,6 +711,16 @@ public void registerBaseCommands() {
|
||||
tabList.add("hand");
|
||||
return ImmutableList.copyOf(tabList);
|
||||
});
|
||||
manager.getCommandCompletions().registerCompletion("gdblockfaces", c -> {
|
||||
List<String> tabList = new ArrayList<>();
|
||||
tabList.add("north");
|
||||
tabList.add("east");
|
||||
tabList.add("south");
|
||||
tabList.add("west");
|
||||
tabList.add("up");
|
||||
tabList.add("down");
|
||||
return ImmutableList.copyOf(tabList);
|
||||
});
|
||||
manager.getCommandCompletions().registerCompletion("gdclaimtypes", c -> {
|
||||
List<String> tabList = new ArrayList<>();
|
||||
for (ClaimType type : ClaimTypeRegistryModule.getInstance().getAll()) {
|
||||
|
@ -255,6 +255,18 @@ public ClaimVisual getVisualizer() {
|
||||
return this.claimVisual;
|
||||
}
|
||||
|
||||
public void resetVisuals() {
|
||||
List<UUID> playersWatching = new ArrayList<>(this.playersWatching);
|
||||
for (UUID playerUniqueId : playersWatching) {
|
||||
final Player spongePlayer = Bukkit.getServer().getPlayer(playerUniqueId);
|
||||
final GDPlayerData data = this.worldClaimManager.getOrCreatePlayerData(playerUniqueId);
|
||||
if (spongePlayer != null) {
|
||||
data.revertActiveVisual(spongePlayer);
|
||||
}
|
||||
}
|
||||
this.claimVisual = null;
|
||||
}
|
||||
|
||||
public GDPlayerData getOwnerPlayerData() {
|
||||
if (this.ownerPlayerData == null && this.ownerUniqueId != null) {
|
||||
this.ownerPlayerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(this.world.getUID(), this.ownerUniqueId);
|
||||
@ -1310,6 +1322,7 @@ public ClaimResult resize(int x1, int x2, int y1, int y2, int z1, int z2) {
|
||||
if (result.getClaims().size() > 1) {
|
||||
this.migrateClaims(new ArrayList<>(result.getClaims()));
|
||||
}
|
||||
this.resetVisuals();
|
||||
return new GDClaimResult(this, ClaimResultType.SUCCESS);
|
||||
}
|
||||
|
||||
@ -1430,6 +1443,7 @@ public ClaimResult resizeCuboid(Player player, int smallX, int smallY, int small
|
||||
if (result.getClaims().size() > 1) {
|
||||
this.migrateClaims(new ArrayList<>(result.getClaims()));
|
||||
}
|
||||
this.resetVisuals();
|
||||
return new GDClaimResult(this, ClaimResultType.SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -32,15 +32,14 @@ public class GDClaimType implements ClaimType {
|
||||
|
||||
private final String id;
|
||||
private final String name;
|
||||
private final Context context;
|
||||
private final Context defaultContext;
|
||||
private final Context overrideContext;
|
||||
|
||||
public GDClaimType(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.context = new Context("gd_claim_type", name.toLowerCase());
|
||||
if (name.equalsIgnoreCase("any")) {
|
||||
|
||||
if (name.equalsIgnoreCase("any") || name.equalsIgnoreCase("global")) {
|
||||
this.defaultContext = ClaimContexts.GLOBAL_DEFAULT_CONTEXT;
|
||||
this.overrideContext = ClaimContexts.GLOBAL_OVERRIDE_CONTEXT;
|
||||
} else if (name.equalsIgnoreCase("admin")) {
|
||||
@ -80,7 +79,7 @@ public String toString() {
|
||||
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return this.context;
|
||||
return this.defaultContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -394,6 +394,7 @@ protected void showFlagPermissions(GDPermissionUser src, GDClaim claim, MenuType
|
||||
}
|
||||
}
|
||||
|
||||
final List<Claim> inheritParents = claim.getInheritedParents();
|
||||
for (Map.Entry<Set<Context>, Map<String, Boolean>> mapEntry : PermissionUtil.getInstance().getPermanentPermissions(claim, this.subject).entrySet()) {
|
||||
final Set<Context> contextSet = mapEntry.getKey();
|
||||
if (contextSet.contains(ClaimContexts.GLOBAL_DEFAULT_CONTEXT)) {
|
||||
@ -406,6 +407,13 @@ protected void showFlagPermissions(GDPermissionUser src, GDClaim claim, MenuType
|
||||
if (contextSet.contains(claim.getContext())) {
|
||||
this.addFilteredContexts(filteredContextMap, contextSet, MenuType.CLAIM, mapEntry.getValue());
|
||||
}
|
||||
for (Claim parentClaim : inheritParents) {
|
||||
GDClaim parent = (GDClaim) parentClaim;
|
||||
// check parent context
|
||||
if (contextSet.contains(parent.getContext())) {
|
||||
this.addFilteredContexts(filteredContextMap, contextSet, MenuType.INHERIT, mapEntry.getValue());
|
||||
}
|
||||
}
|
||||
if (contextSet.contains(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT)) {
|
||||
this.addFilteredContexts(filteredContextMap, contextSet, MenuType.OVERRIDE, mapEntry.getValue());
|
||||
}
|
||||
@ -417,20 +425,6 @@ protected void showFlagPermissions(GDPermissionUser src, GDClaim claim, MenuType
|
||||
}
|
||||
}
|
||||
|
||||
Map<Set<Context>, ClaimClickData> inheritPermissionMap = Maps.newHashMap();
|
||||
|
||||
final List<Claim> inheritParents = claim.getInheritedParents();
|
||||
Collections.reverse(inheritParents);
|
||||
for (Claim current : inheritParents) {
|
||||
GDClaim currentClaim = (GDClaim) current;
|
||||
for (Map.Entry<Set<Context>, Map<String, Boolean>> mapEntry : PermissionUtil.getInstance().getPermanentPermissions(claim, this.subject).entrySet()) {
|
||||
final Set<Context> contextSet = mapEntry.getKey();
|
||||
if (contextSet.contains(currentClaim.getContext())) {
|
||||
inheritPermissionMap.put(mapEntry.getKey(), new ClaimClickData(currentClaim, mapEntry.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final Map<String, Map<Integer, Component>> textMap = new TreeMap<>();
|
||||
for (Entry<String, FlagData> mapEntry : filteredContextMap.entrySet()) {
|
||||
final FlagData flagData = mapEntry.getValue();
|
||||
@ -755,9 +749,27 @@ private Component getClickableText(GDPermissionUser src, GDClaim claim, Flag fla
|
||||
hasEditPermission = false;
|
||||
}
|
||||
} else if (flagType == MenuType.INHERIT) {
|
||||
hoverEventText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.FLAG_UI_INHERIT_PARENT,
|
||||
ImmutableMap.of("name", claim.getFriendlyNameType()));
|
||||
hasEditPermission = false;
|
||||
UUID parentUniqueId = null;
|
||||
for (Context context : contexts) {
|
||||
if (context.getKey().equals("gd_claim")) {
|
||||
try {
|
||||
parentUniqueId = UUID.fromString(context.getValue());
|
||||
} catch (IllegalArgumentException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
// should never happen but just in case
|
||||
if (parentUniqueId == null) {
|
||||
hoverEventText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.FLAG_UI_INHERIT_PARENT,
|
||||
ImmutableMap.of("name", "unknown"));
|
||||
hasEditPermission = false;
|
||||
} else {
|
||||
final GDClaim parentClaim = (GDClaim) GriefDefenderPlugin.getInstance().dataStore.getClaim(claim.getWorldUniqueId(), parentUniqueId);
|
||||
hoverEventText = MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.FLAG_UI_INHERIT_PARENT,
|
||||
ImmutableMap.of("name", parentClaim.getFriendlyNameType()));
|
||||
hasEditPermission = false;
|
||||
}
|
||||
} else {
|
||||
Component denyReason = claim.allowEdit(player);
|
||||
if (denyReason != null) {
|
||||
|
@ -588,28 +588,24 @@ private Consumer<CommandSender> newOptionValueConsumer(GDPermissionUser src, GDC
|
||||
String newValue = "";
|
||||
if (option.getAllowedType().isAssignableFrom(Tristate.class)) {
|
||||
Tristate value = getMenuTypeValue(TypeToken.of(Tristate.class), currentValue);
|
||||
if (displayType == MenuType.CLAIM && optionHolder.getType() == MenuType.DEFAULT) {
|
||||
if (value == Tristate.TRUE) {
|
||||
newValue = "false";
|
||||
} else if (value == Tristate.FALSE) {
|
||||
newValue = "undefined";
|
||||
} else {
|
||||
newValue = "true";
|
||||
}
|
||||
} else {
|
||||
// Always fall back to transient default
|
||||
if (value == Tristate.TRUE) {
|
||||
newValue = "false";
|
||||
} else if (value == Tristate.FALSE) {
|
||||
newValue = "undefined";
|
||||
} else {
|
||||
newValue = "true";
|
||||
}
|
||||
}
|
||||
if (option.getAllowedType().isAssignableFrom(Boolean.class)) {
|
||||
Boolean value = getMenuTypeValue(TypeToken.of(Boolean.class), currentValue);
|
||||
if (value == null) {
|
||||
newValue = "true";
|
||||
} else if (value) {
|
||||
newValue = "false";
|
||||
Tristate result = Tristate.UNDEFINED;
|
||||
if (displayType == MenuType.DEFAULT || (displayType == MenuType.CLAIM && optionHolder.getType() == MenuType.DEFAULT)) {
|
||||
result = Tristate.fromBoolean(!value);
|
||||
} else {
|
||||
newValue = "undefined";
|
||||
// Always fall back to transient default
|
||||
result = Tristate.UNDEFINED;
|
||||
}
|
||||
newValue = result.toString().toLowerCase();
|
||||
}
|
||||
if (option.getAllowedType().isAssignableFrom(GameModeType.class)) {
|
||||
GameModeType value = getMenuTypeValue(TypeToken.of(GameModeType.class), currentValue);
|
||||
@ -843,6 +839,12 @@ private static <T> T getMenuTypeValue(TypeToken<T> type, String value) {
|
||||
if (value.equalsIgnoreCase("undefined")) {
|
||||
return (T) Tristate.UNDEFINED;
|
||||
}
|
||||
if (value.equalsIgnoreCase("true")) {
|
||||
return (T) Tristate.TRUE;
|
||||
}
|
||||
if (value.equalsIgnoreCase("false")) {
|
||||
return (T) Tristate.FALSE;
|
||||
}
|
||||
int permValue = 0;
|
||||
try {
|
||||
permValue = Integer.parseInt(value);
|
||||
|
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* 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 java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.flowpowered.math.vector.Vector3i;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.griefdefender.GDPlayerData;
|
||||
import com.griefdefender.GriefDefenderPlugin;
|
||||
import com.griefdefender.api.claim.Claim;
|
||||
import com.griefdefender.api.claim.ClaimBlockSystem;
|
||||
import com.griefdefender.api.claim.ClaimResult;
|
||||
import com.griefdefender.api.claim.ClaimResultType;
|
||||
import com.griefdefender.cache.MessageCache;
|
||||
import com.griefdefender.cache.PermissionHolderCache;
|
||||
import com.griefdefender.claim.GDClaim;
|
||||
import com.griefdefender.configuration.MessageStorage;
|
||||
import com.griefdefender.permission.GDPermissionUser;
|
||||
import com.griefdefender.permission.GDPermissions;
|
||||
import com.griefdefender.provider.VaultProvider;
|
||||
import com.griefdefender.util.PlayerUtil;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.format.TextColor;
|
||||
|
||||
@CommandAlias("%griefdefender")
|
||||
@CommandPermission(GDPermissions.COMMAND_CLAIM_EXPAND)
|
||||
public class CommandClaimContract extends BaseCommand {
|
||||
|
||||
@CommandCompletion("@gdblockfaces @gddummy")
|
||||
@CommandAlias("claimcontract|contractclaim")
|
||||
@Description("Contracts/Shrinks the claim from the direction you are facing.")
|
||||
@Syntax("<amount> [direction]")
|
||||
@Subcommand("claim contract")
|
||||
public void execute(Player player, int amount, @Optional String direction) {
|
||||
final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(player);
|
||||
final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(user.getInternalPlayerData(), player.getLocation());
|
||||
final GDPlayerData playerData = user.getInternalPlayerData();
|
||||
|
||||
if (claim.isWilderness()) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_NOT_YOURS);
|
||||
return;
|
||||
}
|
||||
if (!claim.getInternalClaimData().isResizable() || (!claim.getOwnerUniqueId().equals(player.getUniqueId()) && !playerData.canIgnoreClaim(claim) && claim.allowEdit(player) != null)) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().PERMISSION_CLAIM_RESIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
final BlockFace face = direction == null ? PlayerUtil.getInstance().getBlockFace(player) : PlayerUtil.getInstance().getBlockFace(direction);
|
||||
if (face == null || amount <= 0) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((face == BlockFace.UP || face == BlockFace.DOWN) && !claim.cuboid) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
final Vector3i lesser = claim.lesserBoundaryCorner;
|
||||
final Vector3i greater = claim.greaterBoundaryCorner;
|
||||
Vector3i point1 = null;
|
||||
Vector3i point2 = null;
|
||||
if (face == BlockFace.EAST) {
|
||||
point1 = new Vector3i(lesser.getX(), lesser.getY(), lesser.getZ());
|
||||
point2 = new Vector3i(greater.getX() - amount, greater.getY(), greater.getZ());
|
||||
} else if (face == BlockFace.WEST) {
|
||||
point1 = new Vector3i(lesser.getX() + amount, lesser.getY(), lesser.getZ());
|
||||
point2 = new Vector3i(greater.getX(), greater.getY(), greater.getZ());
|
||||
} else if (face == BlockFace.NORTH) {
|
||||
point1 = new Vector3i(lesser.getX(), lesser.getY(), lesser.getZ() + amount);
|
||||
point2 = new Vector3i(greater.getX(), greater.getY(), greater.getZ());
|
||||
} else if (face == BlockFace.SOUTH) {
|
||||
point1 = new Vector3i(lesser.getX(), lesser.getY(), lesser.getZ());
|
||||
point2 = new Vector3i(greater.getX(), greater.getY(), greater.getZ() - amount);
|
||||
}
|
||||
|
||||
final ClaimResult result = claim.resize(point1, point2);
|
||||
if (!result.successful()) {
|
||||
if (result.getResultType() == ClaimResultType.OVERLAPPING_CLAIM) {
|
||||
GDClaim overlapClaim = (GDClaim) result.getClaim().get();
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().RESIZE_OVERLAP);
|
||||
Set<Claim> claims = new HashSet<>();
|
||||
claims.add(overlapClaim);
|
||||
CommandHelper.showOverlapClaims(player, claims, player.getEyeLocation().getBlockY());
|
||||
} else {
|
||||
// TODO add to lang
|
||||
GriefDefenderPlugin.sendMessage(player, TextComponent.of("Could not resize claim. Reason : " + result.getResultType()).color(TextColor.RED));
|
||||
}
|
||||
} else {
|
||||
int claimBlocksRemaining = playerData.getRemainingClaimBlocks();;
|
||||
if (!claim.isAdminClaim()) {
|
||||
UUID ownerID = claim.getOwnerUniqueId();
|
||||
if (claim.parent != null) {
|
||||
ownerID = claim.parent.getOwnerUniqueId();
|
||||
}
|
||||
|
||||
if (ownerID.equals(player.getUniqueId())) {
|
||||
claimBlocksRemaining = playerData.getRemainingClaimBlocks();
|
||||
} else {
|
||||
GDPlayerData ownerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), ownerID);
|
||||
claimBlocksRemaining = ownerData.getRemainingClaimBlocks();
|
||||
final Player owner = Bukkit.getPlayer(ownerID);
|
||||
if (owner == null || !owner.isOnline()) {
|
||||
GriefDefenderPlugin.getInstance().dataStore.clearCachedPlayerData(player.getWorld().getUID(), ownerID);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) {
|
||||
final VaultProvider vaultProvider = GriefDefenderPlugin.getInstance().getVaultProvider();
|
||||
if (vaultProvider.hasAccount(player)) {
|
||||
if (GriefDefenderPlugin.CLAIM_BLOCK_SYSTEM == ClaimBlockSystem.VOLUME) {
|
||||
final double claimableChunks = claimBlocksRemaining / 65536.0;
|
||||
final Map<String, Object> params = ImmutableMap.of(
|
||||
"balance", String.valueOf("$" + vaultProvider.getBalance(player)),
|
||||
"chunk-amount", Math.round(claimableChunks * 100.0)/100.0,
|
||||
"block-amount", claimBlocksRemaining);
|
||||
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_MODE_RESIZE_SUCCESS_3D, params));
|
||||
} else {
|
||||
final Map<String, Object> params = ImmutableMap.of(
|
||||
"balance", String.valueOf("$" + vaultProvider.getBalance(player)),
|
||||
"block-amount", claimBlocksRemaining);
|
||||
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_MODE_RESIZE_SUCCESS_2D, params));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (GriefDefenderPlugin.CLAIM_BLOCK_SYSTEM == ClaimBlockSystem.VOLUME) {
|
||||
final double claimableChunks = claimBlocksRemaining / 65536.0;
|
||||
final Map<String, Object> params = ImmutableMap.of(
|
||||
"chunk-amount", Math.round(claimableChunks * 100.0)/100.0,
|
||||
"block-amount", claimBlocksRemaining);
|
||||
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.RESIZE_SUCCESS_3D, params));
|
||||
} else {
|
||||
final Map<String, Object> params = ImmutableMap.of(
|
||||
"block-amount", claimBlocksRemaining);
|
||||
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.RESIZE_SUCCESS_2D, params));
|
||||
}
|
||||
}
|
||||
playerData.revertActiveVisual(player);
|
||||
claim.getVisualizer().resetVisuals();
|
||||
claim.getVisualizer().createClaimBlockVisuals(player.getEyeLocation().getBlockY(), player.getLocation(), playerData);
|
||||
claim.getVisualizer().apply(player);
|
||||
if (GriefDefenderPlugin.getInstance().getWorldEditProvider() != null) {
|
||||
GriefDefenderPlugin.getInstance().getWorldEditProvider().visualizeClaim(claim, player, playerData, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
/*
|
||||
* 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 java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.flowpowered.math.vector.Vector3i;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.griefdefender.GDPlayerData;
|
||||
import com.griefdefender.GriefDefenderPlugin;
|
||||
import com.griefdefender.api.claim.Claim;
|
||||
import com.griefdefender.api.claim.ClaimBlockSystem;
|
||||
import com.griefdefender.api.claim.ClaimResult;
|
||||
import com.griefdefender.api.claim.ClaimResultType;
|
||||
import com.griefdefender.cache.MessageCache;
|
||||
import com.griefdefender.cache.PermissionHolderCache;
|
||||
import com.griefdefender.claim.GDClaim;
|
||||
import com.griefdefender.configuration.MessageStorage;
|
||||
import com.griefdefender.permission.GDPermissionUser;
|
||||
import com.griefdefender.permission.GDPermissions;
|
||||
import com.griefdefender.provider.VaultProvider;
|
||||
import com.griefdefender.util.PlayerUtil;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.format.TextColor;
|
||||
|
||||
@CommandAlias("%griefdefender")
|
||||
@CommandPermission(GDPermissions.COMMAND_CLAIM_EXPAND)
|
||||
public class CommandClaimExpand extends BaseCommand {
|
||||
|
||||
@CommandCompletion("@gdblockfaces @gddummy")
|
||||
@CommandAlias("claimexpand|expandclaim")
|
||||
@Description("Expands the claim in the direction you are facing.")
|
||||
@Syntax("<amount> [direction]")
|
||||
@Subcommand("claim expand")
|
||||
public void execute(Player player, int amount, @Optional String direction) {
|
||||
final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(player);
|
||||
final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(user.getInternalPlayerData(), player.getLocation());
|
||||
final GDPlayerData playerData = user.getInternalPlayerData();
|
||||
|
||||
if (claim.isWilderness()) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().CLAIM_NOT_YOURS);
|
||||
return;
|
||||
}
|
||||
if (!claim.getInternalClaimData().isResizable() || (!claim.getOwnerUniqueId().equals(player.getUniqueId()) && !playerData.canIgnoreClaim(claim) && claim.allowEdit(player) != null)) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().PERMISSION_CLAIM_RESIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
final BlockFace face = direction == null ? PlayerUtil.getInstance().getBlockFace(player) : PlayerUtil.getInstance().getBlockFace(direction);
|
||||
if (face == null || amount <= 0) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((face == BlockFace.UP || face == BlockFace.DOWN) && !claim.cuboid) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().COMMAND_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("PLAYER IS FACING " + face);
|
||||
final Vector3i lesser = claim.lesserBoundaryCorner;
|
||||
final Vector3i greater = claim.greaterBoundaryCorner;
|
||||
System.out.println("CURRENT CORNERS lesser = " + lesser + ", greater = " + greater);
|
||||
Vector3i point1 = null;
|
||||
Vector3i point2 = null;
|
||||
if (face == BlockFace.EAST) {
|
||||
point1 = new Vector3i(lesser.getX(), lesser.getY(), lesser.getZ());
|
||||
point2 = new Vector3i(greater.getX() + amount, greater.getY(), greater.getZ());
|
||||
} else if (face == BlockFace.WEST) {
|
||||
point1 = new Vector3i(lesser.getX() - amount, lesser.getY(), lesser.getZ());
|
||||
point2 = new Vector3i(greater.getX(), greater.getY(), greater.getZ());
|
||||
} else if (face == BlockFace.NORTH) {
|
||||
point1 = new Vector3i(lesser.getX(), lesser.getY(), lesser.getZ() - amount);
|
||||
point2 = new Vector3i(greater.getX(), greater.getY(), greater.getZ());
|
||||
} else if (face == BlockFace.SOUTH) {
|
||||
point1 = new Vector3i(lesser.getX(), lesser.getY(), lesser.getZ());
|
||||
point2 = new Vector3i(greater.getX(), greater.getY(), greater.getZ() + amount);
|
||||
}
|
||||
|
||||
final ClaimResult result = claim.resize(point1, point2);
|
||||
if (!result.successful()) {
|
||||
if (result.getResultType() == ClaimResultType.OVERLAPPING_CLAIM) {
|
||||
GDClaim overlapClaim = (GDClaim) result.getClaim().get();
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().RESIZE_OVERLAP);
|
||||
Set<Claim> claims = new HashSet<>();
|
||||
claims.add(overlapClaim);
|
||||
CommandHelper.showOverlapClaims(player, claims, player.getEyeLocation().getBlockY());
|
||||
} else {
|
||||
// TODO add to lang
|
||||
GriefDefenderPlugin.sendMessage(player, TextComponent.of("Could not resize claim. Reason : " + result.getResultType()).color(TextColor.RED));
|
||||
}
|
||||
} else {
|
||||
int claimBlocksRemaining = playerData.getRemainingClaimBlocks();;
|
||||
if (!claim.isAdminClaim()) {
|
||||
UUID ownerID = claim.getOwnerUniqueId();
|
||||
if (claim.parent != null) {
|
||||
ownerID = claim.parent.getOwnerUniqueId();
|
||||
}
|
||||
|
||||
if (ownerID.equals(player.getUniqueId())) {
|
||||
claimBlocksRemaining = playerData.getRemainingClaimBlocks();
|
||||
} else {
|
||||
GDPlayerData ownerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), ownerID);
|
||||
claimBlocksRemaining = ownerData.getRemainingClaimBlocks();
|
||||
final Player owner = Bukkit.getPlayer(ownerID);
|
||||
if (owner == null || !owner.isOnline()) {
|
||||
GriefDefenderPlugin.getInstance().dataStore.clearCachedPlayerData(player.getWorld().getUID(), ownerID);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (GriefDefenderPlugin.getInstance().isEconomyModeEnabled()) {
|
||||
final VaultProvider vaultProvider = GriefDefenderPlugin.getInstance().getVaultProvider();
|
||||
if (vaultProvider.hasAccount(player)) {
|
||||
if (GriefDefenderPlugin.CLAIM_BLOCK_SYSTEM == ClaimBlockSystem.VOLUME) {
|
||||
final double claimableChunks = claimBlocksRemaining / 65536.0;
|
||||
final Map<String, Object> params = ImmutableMap.of(
|
||||
"balance", String.valueOf("$" + vaultProvider.getBalance(player)),
|
||||
"chunk-amount", Math.round(claimableChunks * 100.0)/100.0,
|
||||
"block-amount", claimBlocksRemaining);
|
||||
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_MODE_RESIZE_SUCCESS_3D, params));
|
||||
} else {
|
||||
final Map<String, Object> params = ImmutableMap.of(
|
||||
"balance", String.valueOf("$" + vaultProvider.getBalance(player)),
|
||||
"block-amount", claimBlocksRemaining);
|
||||
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.ECONOMY_MODE_RESIZE_SUCCESS_2D, params));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (GriefDefenderPlugin.CLAIM_BLOCK_SYSTEM == ClaimBlockSystem.VOLUME) {
|
||||
final double claimableChunks = claimBlocksRemaining / 65536.0;
|
||||
final Map<String, Object> params = ImmutableMap.of(
|
||||
"chunk-amount", Math.round(claimableChunks * 100.0)/100.0,
|
||||
"block-amount", claimBlocksRemaining);
|
||||
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.RESIZE_SUCCESS_3D, params));
|
||||
} else {
|
||||
final Map<String, Object> params = ImmutableMap.of(
|
||||
"block-amount", claimBlocksRemaining);
|
||||
GriefDefenderPlugin.sendMessage(player, GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.RESIZE_SUCCESS_2D, params));
|
||||
}
|
||||
}
|
||||
playerData.revertActiveVisual(player);
|
||||
claim.getVisualizer().resetVisuals();
|
||||
claim.getVisualizer().createClaimBlockVisuals(player.getEyeLocation().getBlockY(), player.getLocation(), playerData);
|
||||
claim.getVisualizer().apply(player);
|
||||
if (GriefDefenderPlugin.getInstance().getWorldEditProvider() != null) {
|
||||
GriefDefenderPlugin.getInstance().getWorldEditProvider().visualizeClaim(claim, player, playerData, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -540,10 +540,16 @@ public void execute(CommandSender src, String[] args) {
|
||||
.append(MessageCache.getInstance().CLAIMINFO_UI_DENY_MESSAGES.color(TextColor.YELLOW))
|
||||
.append(" : ")
|
||||
.append(getClickableInfoText(src, claim, DENY_MESSAGES, claim.getData().allowDenyMessages() ? TextComponent.of("ON", TextColor.GREEN) : TextComponent.of("OFF", TextColor.RED))).build();
|
||||
Component pvpSetting = TextComponent.of("UNDEFINED", TextColor.GRAY);
|
||||
if (claim.getData().getPvpOverride() == Tristate.TRUE) {
|
||||
pvpSetting = TextComponent.of("ON", TextColor.GREEN);
|
||||
} else if (claim.getData().getPvpOverride() == Tristate.FALSE) {
|
||||
pvpSetting = TextComponent.of("OFF", TextColor.RED);
|
||||
}
|
||||
Component claimPvP = TextComponent.builder()
|
||||
.append("PvP", TextColor.YELLOW)
|
||||
.append(" : ")
|
||||
.append(getClickableInfoText(src, claim, PVP_OVERRIDE, claim.getData().getPvpOverride() == Tristate.TRUE ? TextComponent.of("ON", TextColor.GREEN) : TextComponent.of("OFF", TextColor.RED))).build();
|
||||
.append(getClickableInfoText(src, claim, PVP_OVERRIDE, pvpSetting)).build();
|
||||
Component claimRaid = TextComponent.builder()
|
||||
.append("Raid", TextColor.YELLOW)
|
||||
.append(" : ")
|
||||
@ -556,7 +562,7 @@ public void execute(CommandSender src, String[] args) {
|
||||
.append(MessageCache.getInstance().LABEL_SPAWN.color(TextColor.GREEN))
|
||||
.append(" : ")
|
||||
.append(spawnPos.toString(), TextColor.GRAY)
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(CommandHelper.createTeleportConsumer(player, spawnLoc, claim))))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(CommandHelper.createTeleportConsumer(player, spawnLoc, claim, true))))
|
||||
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().CLAIMINFO_UI_TELEPORT_SPAWN))
|
||||
.build();
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ public void execute(Player player, String name) {
|
||||
claim.getInternalClaimData().setName(text);
|
||||
}
|
||||
claim.getInternalClaimData().setRequiresSave(true);
|
||||
claim.getInternalClaimData().save();
|
||||
final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.CLAIM_NAME,
|
||||
ImmutableMap.of(
|
||||
"name", text));
|
||||
|
@ -665,7 +665,7 @@ public static List<Component> generateClaimTextList(List<Component> claimsTextLi
|
||||
.append("[")
|
||||
.append("TP", TextColor.LIGHT_PURPLE)
|
||||
.append("]")
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(CommandHelper.createTeleportConsumer(src, spawnLoc, claim))))
|
||||
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(CommandHelper.createTeleportConsumer(src, spawnLoc, claim, true))))
|
||||
.hoverEvent(HoverEvent.showText(MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.CLAIMLIST_UI_CLICK_TELEPORT_TARGET,
|
||||
ImmutableMap.of(
|
||||
"name", teleportName,
|
||||
@ -998,6 +998,10 @@ public static String getTrustPermission(TrustType trustType) {
|
||||
}
|
||||
|
||||
public static Consumer<CommandSender> createTeleportConsumer(CommandSender src, Location location, Claim claim) {
|
||||
return createTeleportConsumer(src, location, claim, false);
|
||||
}
|
||||
|
||||
public static Consumer<CommandSender> createTeleportConsumer(CommandSender src, Location location, Claim claim, boolean isClaimSpawn) {
|
||||
return teleport -> {
|
||||
if (!(src instanceof Player)) {
|
||||
// ignore
|
||||
@ -1019,7 +1023,12 @@ public static Consumer<CommandSender> createTeleportConsumer(CommandSender src,
|
||||
}
|
||||
}
|
||||
|
||||
final double safeY = player.getWorld().getHighestBlockYAt(location);
|
||||
if (isClaimSpawn) {
|
||||
player.teleport(location, TeleportCause.PLUGIN);
|
||||
return;
|
||||
}
|
||||
|
||||
final double safeY = player.getWorld().getEnvironment() != Environment.NETHER ? player.getWorld().getHighestBlockYAt(location) : location.getBlockY();
|
||||
location.setY(safeY);
|
||||
int currentY = location.getBlockY();
|
||||
while (currentY < player.getWorld().getMaxHeight()) {
|
||||
|
@ -30,23 +30,33 @@
|
||||
import com.griefdefender.api.User;
|
||||
import com.griefdefender.api.claim.Claim;
|
||||
import com.griefdefender.api.event.BorderClaimEvent;
|
||||
import com.griefdefender.cache.PermissionHolderCache;
|
||||
|
||||
import net.kyori.text.Component;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class GDBorderClaimEvent extends GDClaimEvent implements BorderClaimEvent {
|
||||
|
||||
private final User user;
|
||||
private final Entity entity;
|
||||
private final UUID uniqueId;
|
||||
private final Claim exitClaim;
|
||||
private Component enterMessage;
|
||||
private Component exitMessage;
|
||||
private ChatType enterChatType = ChatTypes.CHAT;
|
||||
private ChatType exitChatType = ChatTypes.CHAT;
|
||||
|
||||
public GDBorderClaimEvent(User user, Claim exit, Claim enter) {
|
||||
public GDBorderClaimEvent(Entity entity, Claim exit, Claim enter) {
|
||||
super(enter);
|
||||
this.user = user;
|
||||
this.user = entity instanceof Player ? PermissionHolderCache.getInstance().getOrCreateUser((Player) entity) : null;
|
||||
this.entity = entity;
|
||||
this.uniqueId = entity.getUniqueId();
|
||||
this.exitClaim = exit;
|
||||
final int defaultChatType = GriefDefenderPlugin.getGlobalConfig().getConfig().message.enterExitChatType;
|
||||
if (defaultChatType == 1) {
|
||||
@ -60,9 +70,18 @@ public Claim getExitClaim() {
|
||||
return this.exitClaim;
|
||||
}
|
||||
|
||||
public Entity getEntity() {
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return this.user;
|
||||
public UUID getEntityUniqueId() {
|
||||
return this.uniqueId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<User> getUser() {
|
||||
return Optional.ofNullable(this.user);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,334 @@
|
||||
/*
|
||||
* 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.listener;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.flowpowered.math.vector.Vector3i;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.griefdefender.GDPlayerData;
|
||||
import com.griefdefender.GDTimings;
|
||||
import com.griefdefender.GriefDefenderPlugin;
|
||||
import com.griefdefender.api.ChatType;
|
||||
import com.griefdefender.api.ChatTypes;
|
||||
import com.griefdefender.api.GriefDefender;
|
||||
import com.griefdefender.api.Tristate;
|
||||
import com.griefdefender.api.claim.TrustTypes;
|
||||
import com.griefdefender.api.permission.flag.Flags;
|
||||
import com.griefdefender.api.permission.option.Options;
|
||||
import com.griefdefender.cache.MessageCache;
|
||||
import com.griefdefender.cache.PermissionHolderCache;
|
||||
import com.griefdefender.claim.GDClaim;
|
||||
import com.griefdefender.configuration.MessageStorage;
|
||||
import com.griefdefender.event.GDBorderClaimEvent;
|
||||
import com.griefdefender.internal.registry.ItemTypeRegistryModule;
|
||||
import com.griefdefender.internal.util.VecHelper;
|
||||
import com.griefdefender.permission.GDPermissionManager;
|
||||
import com.griefdefender.permission.GDPermissionUser;
|
||||
import com.griefdefender.permission.GDPermissions;
|
||||
import com.griefdefender.permission.flag.GDFlags;
|
||||
import com.griefdefender.storage.BaseStorage;
|
||||
|
||||
import net.kyori.text.Component;
|
||||
import net.kyori.text.TextComponent;
|
||||
import net.kyori.text.adapter.bukkit.TextAdapter;
|
||||
|
||||
public class CommonEntityEventHandler {
|
||||
|
||||
private static CommonEntityEventHandler instance;
|
||||
|
||||
public static CommonEntityEventHandler getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
static {
|
||||
instance = new CommonEntityEventHandler();
|
||||
}
|
||||
|
||||
private final BaseStorage storage;
|
||||
|
||||
public CommonEntityEventHandler() {
|
||||
this.storage = GriefDefenderPlugin.getInstance().dataStore;
|
||||
}
|
||||
|
||||
public void onEntityMove(Event event, Location fromLocation, Location toLocation, Entity targetEntity){
|
||||
final Vector3i fromPos = VecHelper.toVector3i(fromLocation);
|
||||
final Vector3i toPos = VecHelper.toVector3i(toLocation);
|
||||
if (fromPos.equals(toPos)) {
|
||||
return;
|
||||
}
|
||||
if ((!GDFlags.ENTER_CLAIM && !GDFlags.EXIT_CLAIM)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = targetEntity instanceof Player ? (Player) targetEntity : null;
|
||||
final GDPermissionUser user = player != null ? PermissionHolderCache.getInstance().getOrCreateUser(player) : null;
|
||||
final World world = targetEntity.getWorld();
|
||||
if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(world.getUID())) {
|
||||
return;
|
||||
}
|
||||
final boolean enterBlacklisted = GriefDefenderPlugin.isSourceIdBlacklisted(Flags.ENTER_CLAIM.getName(), targetEntity, world.getUID());
|
||||
final boolean exitBlacklisted = GriefDefenderPlugin.isSourceIdBlacklisted(Flags.EXIT_CLAIM.getName(), targetEntity, world.getUID());
|
||||
if (enterBlacklisted && exitBlacklisted) {
|
||||
return;
|
||||
}
|
||||
|
||||
GDTimings.ENTITY_MOVE_EVENT.startTiming();
|
||||
|
||||
GDClaim fromClaim = null;
|
||||
GDClaim toClaim = this.storage.getClaimAt(toLocation);
|
||||
if (user != null) {
|
||||
fromClaim = this.storage.getClaimAtPlayer(user.getInternalPlayerData(), fromLocation);
|
||||
} else {
|
||||
fromClaim = this.storage.getClaimAt(fromLocation);
|
||||
}
|
||||
|
||||
if (GDFlags.ENTER_CLAIM && !enterBlacklisted && user != null && user.getInternalPlayerData().lastClaim != null) {
|
||||
final GDClaim lastClaim = (GDClaim) user.getInternalPlayerData().lastClaim.get();
|
||||
if (lastClaim != null && lastClaim != fromClaim) {
|
||||
if (GDPermissionManager.getInstance().getFinalPermission(event, toLocation, toClaim, GDPermissions.ENTER_CLAIM, targetEntity, targetEntity, player, TrustTypes.ACCESSOR, false) == Tristate.FALSE) {
|
||||
Location claimCorner = new Location(toLocation.getWorld(), toClaim.lesserBoundaryCorner.getX(), targetEntity.getLocation().getBlockY(), toClaim.greaterBoundaryCorner.getZ());
|
||||
targetEntity.teleport(claimCorner);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fromClaim == toClaim) {
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
return;
|
||||
}
|
||||
|
||||
GDBorderClaimEvent gpEvent = new GDBorderClaimEvent(targetEntity, fromClaim, toClaim);
|
||||
if (user != null && toClaim.isUserTrusted(user, TrustTypes.ACCESSOR)) {
|
||||
GriefDefender.getEventManager().post(gpEvent);
|
||||
if (gpEvent.cancelled()) {
|
||||
if (targetEntity instanceof Vehicle) {
|
||||
final Vehicle vehicle = (Vehicle) targetEntity;
|
||||
vehicle.teleport(fromLocation);
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
return;
|
||||
}
|
||||
if (event instanceof Cancellable) {
|
||||
((Cancellable) event).setCancelled(true);
|
||||
}
|
||||
final Component cancelMessage = gpEvent.getMessage().orElse(null);
|
||||
if (player != null && cancelMessage != null) {
|
||||
TextAdapter.sendComponent(player, cancelMessage);
|
||||
}
|
||||
} else {
|
||||
final boolean showGpPrefix = GriefDefenderPlugin.getGlobalConfig().getConfig().message.enterExitShowGdPrefix;
|
||||
user.getInternalPlayerData().lastClaim = new WeakReference<>(toClaim);
|
||||
TextComponent welcomeMessage = (TextComponent) gpEvent.getEnterMessage().orElse(null);
|
||||
if (welcomeMessage != null && !welcomeMessage.equals(TextComponent.empty())) {
|
||||
ChatType chatType = gpEvent.getEnterMessageChatType();
|
||||
if (chatType == ChatTypes.ACTION_BAR) {
|
||||
TextAdapter.sendActionBar(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(welcomeMessage)
|
||||
.build());
|
||||
} else {
|
||||
TextAdapter.sendComponent(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(welcomeMessage)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
Component farewellMessage = gpEvent.getExitMessage().orElse(null);
|
||||
if (farewellMessage != null && !farewellMessage.equals(TextComponent.empty()) && !farewellMessage.equals("")) {
|
||||
ChatType chatType = gpEvent.getExitMessageChatType();
|
||||
if (chatType == ChatTypes.ACTION_BAR) {
|
||||
TextAdapter.sendActionBar(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(farewellMessage)
|
||||
.build());
|
||||
} else {
|
||||
TextAdapter.sendComponent(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(farewellMessage)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
if (toClaim.isInTown()) {
|
||||
user.getInternalPlayerData().inTown = true;
|
||||
} else {
|
||||
user.getInternalPlayerData().inTown = false;
|
||||
}
|
||||
}
|
||||
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
return;
|
||||
}
|
||||
|
||||
if (fromClaim != toClaim) {
|
||||
boolean enterCancelled = false;
|
||||
boolean exitCancelled = false;
|
||||
// enter
|
||||
if (GDFlags.ENTER_CLAIM && !enterBlacklisted && GDPermissionManager.getInstance().getFinalPermission(event, toLocation, toClaim, GDPermissions.ENTER_CLAIM, targetEntity, targetEntity, user) == Tristate.FALSE) {
|
||||
enterCancelled = true;
|
||||
gpEvent.cancelled(true);
|
||||
}
|
||||
|
||||
// exit
|
||||
if (GDFlags.EXIT_CLAIM && !exitBlacklisted && GDPermissionManager.getInstance().getFinalPermission(event, fromLocation, fromClaim, GDPermissions.EXIT_CLAIM, targetEntity, targetEntity, user) == Tristate.FALSE) {
|
||||
exitCancelled = true;
|
||||
gpEvent.cancelled(true);
|
||||
}
|
||||
|
||||
GriefDefender.getEventManager().post(gpEvent);
|
||||
if (gpEvent.cancelled()) {
|
||||
final Component cancelMessage = gpEvent.getMessage().orElse(null);
|
||||
if (exitCancelled) {
|
||||
if (cancelMessage != null && player != null) {
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(fromClaim, player, MessageCache.getInstance().PERMISSION_CLAIM_EXIT);
|
||||
}
|
||||
} else if (enterCancelled) {
|
||||
if (cancelMessage != null && player != null) {
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(toClaim, player, MessageCache.getInstance().PERMISSION_CLAIM_ENTER);
|
||||
}
|
||||
}
|
||||
|
||||
if (cancelMessage != null && player != null) {
|
||||
TextAdapter.sendComponent(player, cancelMessage);
|
||||
}
|
||||
|
||||
if (targetEntity instanceof Vehicle) {
|
||||
final Vehicle vehicle = (Vehicle) targetEntity;
|
||||
vehicle.teleport(fromLocation);
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
return;
|
||||
}
|
||||
if (event instanceof Cancellable) {
|
||||
((Cancellable) event).setCancelled(true);
|
||||
}
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
return;
|
||||
}
|
||||
|
||||
if (user != null) {
|
||||
final boolean showGpPrefix = GriefDefenderPlugin.getGlobalConfig().getConfig().message.enterExitShowGdPrefix;
|
||||
user.getInternalPlayerData().lastClaim = new WeakReference<>(toClaim);
|
||||
Component welcomeMessage = gpEvent.getEnterMessage().orElse(null);
|
||||
if (welcomeMessage != null && !welcomeMessage.equals(TextComponent.empty()) && !welcomeMessage.equals("")) {
|
||||
ChatType chatType = gpEvent.getEnterMessageChatType();
|
||||
if (chatType == ChatTypes.ACTION_BAR) {
|
||||
TextAdapter.sendActionBar(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(welcomeMessage)
|
||||
.build());
|
||||
} else {
|
||||
TextAdapter.sendComponent(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(welcomeMessage)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
Component farewellMessage = gpEvent.getExitMessage().orElse(null);
|
||||
if (farewellMessage != null && !farewellMessage.equals(TextComponent.empty()) && !farewellMessage.equals("")) {
|
||||
ChatType chatType = gpEvent.getExitMessageChatType();
|
||||
if (chatType == ChatTypes.ACTION_BAR) {
|
||||
TextAdapter.sendActionBar(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(farewellMessage)
|
||||
.build());
|
||||
} else {
|
||||
TextAdapter.sendComponent(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(farewellMessage)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
if (toClaim.isInTown()) {
|
||||
user.getInternalPlayerData().inTown = true;
|
||||
} else {
|
||||
user.getInternalPlayerData().inTown = false;
|
||||
}
|
||||
|
||||
checkPlayerFlight(player, user.getInternalPlayerData(), fromClaim, toClaim);
|
||||
}
|
||||
}
|
||||
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
}
|
||||
|
||||
private void checkPlayerFlight(Player player, GDPlayerData playerData, GDClaim fromClaim, GDClaim toClaim) {
|
||||
final GameMode gameMode = player.getGameMode();
|
||||
if (gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fromClaim == toClaim || !player.isFlying()) {
|
||||
// only handle player-fly in enter/exit
|
||||
return;
|
||||
}
|
||||
|
||||
final Boolean noFly = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), playerData.getSubject(), Options.PLAYER_DENY_FLIGHT, toClaim);
|
||||
final boolean adminFly = player.hasPermission(GDPermissions.BYPASS_OPTION);
|
||||
final boolean ownerFly = toClaim.isBasicClaim() ? player.hasPermission(GDPermissions.USER_OPTION_PERK_OWNER_FLY_BASIC) : toClaim.isTown() ? player.hasPermission(GDPermissions.USER_OPTION_PERK_OWNER_FLY_TOWN) : false;
|
||||
if (player.getUniqueId().equals(toClaim.getOwnerUniqueId()) && ownerFly) {
|
||||
return;
|
||||
}
|
||||
if (!adminFly && noFly) {
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
playerData.ignoreFallDamage = true;
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().OPTION_PLAYER_DENY_FLIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendInteractEntityDenyMessage(ItemStack playerItem, Entity entity, GDClaim claim, Player player) {
|
||||
if (entity instanceof Player || (claim.getData() != null && !claim.getData().allowDenyMessages())) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String entityId = entity.getType().getName() == null ? entity.getType().name().toLowerCase() : entity.getType().getName();
|
||||
if (playerItem == null || playerItem.getType() == Material.AIR) {
|
||||
final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_INTERACT_ENTITY, ImmutableMap.of(
|
||||
"player", claim.getOwnerName(),
|
||||
"entity", entityId));
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(claim, player, message);
|
||||
} else {
|
||||
final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_INTERACT_ITEM_ENTITY, ImmutableMap.of(
|
||||
"item", ItemTypeRegistryModule.getInstance().getNMSKey(playerItem),
|
||||
"entity", entityId));
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(claim, player, message);
|
||||
}
|
||||
}
|
||||
}
|
@ -86,10 +86,11 @@
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.SlimeSplitEvent;
|
||||
import org.bukkit.event.entity.SpawnerSpawnEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -253,6 +254,11 @@ public void onEntityExplodeEvent(EntityExplodeEvent event) {
|
||||
GDTimings.EXPLOSION_EVENT.stopTiming();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onVehicleMove(VehicleMoveEvent event) {
|
||||
CommonEntityEventHandler.getInstance().onEntityMove(event, event.getFrom(), event.getTo(), event.getVehicle());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onVehicleDamage(VehicleDamageEvent event) {
|
||||
GDTimings.ENTITY_DAMAGE_EVENT.startTiming();
|
||||
@ -299,15 +305,9 @@ public void onEntityDamage(EntityDamageByBlockEvent event) {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onHangingBreakEvent(HangingBreakEvent event) {
|
||||
public void onHangingBreakEvent(HangingBreakByEntityEvent event) {
|
||||
GDTimings.ENTITY_DAMAGE_EVENT.startTiming();
|
||||
Object source = event.getCause().name();
|
||||
final Object causeSource = GDCauseStackManager.getInstance().getCurrentCause().first(Entity.class).orElse(null);
|
||||
if (causeSource != null) {
|
||||
source = causeSource;
|
||||
}
|
||||
|
||||
if (protectEntity(event, source, event.getEntity())) {
|
||||
if (protectEntity(event, event.getRemover(), event.getEntity())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
GDTimings.ENTITY_DAMAGE_EVENT.stopTiming();
|
||||
@ -354,10 +354,13 @@ public boolean protectEntity(Event event, Object source, Entity targetEntity) {
|
||||
}
|
||||
|
||||
final GDClaim claim = this.baseStorage.getClaimAt(targetEntity.getLocation());
|
||||
if (source instanceof Player && targetEntity instanceof Player) {
|
||||
final Player targetPlayer = targetEntity instanceof Player ? (Player) targetEntity : null;
|
||||
boolean checkedPvp = false;
|
||||
if (source instanceof Player && targetPlayer != null) {
|
||||
if (!claim.isPvpEnabled()) {
|
||||
return true;
|
||||
}
|
||||
checkedPvp = true;
|
||||
}
|
||||
String permission = GDPermissions.ENTITY_DAMAGE;
|
||||
ProjectileSource projectileSource = null;
|
||||
@ -375,7 +378,11 @@ public boolean protectEntity(Event event, Object source, Entity targetEntity) {
|
||||
owner = ((Player) targetEntity).getUniqueId();
|
||||
}
|
||||
}
|
||||
|
||||
if (!checkedPvp && owner != null && targetPlayer != null && !owner.equals(targetPlayer.getUniqueId())) {
|
||||
if (!claim.isPvpEnabled()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (source != null && source instanceof Player) {
|
||||
GDCauseStackManager.getInstance().pushCause(source);
|
||||
}
|
||||
@ -416,6 +423,10 @@ public boolean protectEntity(Event event, Object source, Entity targetEntity) {
|
||||
|
||||
final TrustType trustType = TrustTypes.BUILDER;
|
||||
if (GDPermissionManager.getInstance().getFinalPermission(event, targetEntity.getLocation(), claim, permission, source, targetEntity, user, trustType, true) == Tristate.FALSE) {
|
||||
if (source != null && source instanceof Player) {
|
||||
final Player player = (Player) source;
|
||||
CommonEntityEventHandler.getInstance().sendInteractEntityDenyMessage(NMSUtil.getInstance().getActiveItem(player), targetEntity, claim, player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -352,44 +352,6 @@ public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerInteractInventoryOpen(InventoryOpenEvent event) {
|
||||
final InventoryHolder holder = event.getInventory().getHolder();
|
||||
if (holder == null) {
|
||||
// assume custom and ignore
|
||||
return;
|
||||
}
|
||||
|
||||
// Some plugins pass a custom wrapped InventoryHolder with the actual holder within
|
||||
// ex. CrateReloaded
|
||||
if (holder.getInventory() != null && holder.getInventory().getHolder() instanceof Player) {
|
||||
return;
|
||||
}
|
||||
Location location = null;
|
||||
if (holder != null) {
|
||||
if (holder instanceof BlockState) {
|
||||
location = ((BlockState) holder).getLocation();
|
||||
} else if (holder instanceof Entity) {
|
||||
final Entity entity = ((Entity) holder);
|
||||
location = entity.getLocation();
|
||||
// Some custom inventories pass the player as InventoryHolder
|
||||
if (entity instanceof Player) {
|
||||
return;
|
||||
}
|
||||
if (event.getPlayer() != null && entity instanceof Tameable) {
|
||||
final UUID ownerUniqueId = NMSUtil.getInstance().getTameableOwnerUUID(entity);
|
||||
if (ownerUniqueId != null && ownerUniqueId.equals(event.getPlayer().getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (location == null) {
|
||||
location = event.getPlayer().getLocation();
|
||||
}
|
||||
onInventoryOpen(event, location, event.getInventory(), event.getPlayer());
|
||||
}
|
||||
|
||||
private void onInventoryOpen(Event event, Location location, Object target, HumanEntity player) {
|
||||
GDCauseStackManager.getInstance().pushCause(player);
|
||||
if (event instanceof InventoryOpenEvent) {
|
||||
@ -607,7 +569,7 @@ public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
}
|
||||
if (result == Tristate.FALSE) {
|
||||
event.setCancelled(true);
|
||||
this.sendInteractEntityDenyMessage(activeItem, targetEntity, claim, player);
|
||||
CommonEntityEventHandler.getInstance().sendInteractEntityDenyMessage(activeItem, targetEntity, claim, player);
|
||||
}
|
||||
GDTimings.PLAYER_INTERACT_ENTITY_SECONDARY_EVENT.stopTiming();
|
||||
}
|
||||
@ -897,236 +859,7 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerMove(PlayerMoveEvent event){
|
||||
final Vector3i fromPos = VecHelper.toVector3i(event.getFrom());
|
||||
final Vector3i toPos = VecHelper.toVector3i(event.getTo());
|
||||
if (fromPos.equals(toPos)) {
|
||||
return;
|
||||
}
|
||||
if ((!GDFlags.ENTER_CLAIM && !GDFlags.EXIT_CLAIM)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(player);
|
||||
final World world = event.getPlayer().getWorld();
|
||||
if (!GriefDefenderPlugin.getInstance().claimsEnabledForWorld(world.getUID())) {
|
||||
return;
|
||||
}
|
||||
final boolean enterBlacklisted = GriefDefenderPlugin.isSourceIdBlacklisted(Flags.ENTER_CLAIM.getName(), player, world.getUID());
|
||||
final boolean exitBlacklisted = GriefDefenderPlugin.isSourceIdBlacklisted(Flags.EXIT_CLAIM.getName(), player, world.getUID());
|
||||
if (enterBlacklisted && exitBlacklisted) {
|
||||
return;
|
||||
}
|
||||
|
||||
GDTimings.ENTITY_MOVE_EVENT.startTiming();
|
||||
GDPlayerData playerData = this.dataStore.getOrCreatePlayerData(world, player.getUniqueId());
|
||||
|
||||
final Location fromLocation = event.getFrom();
|
||||
final Location toLocation = event.getTo();
|
||||
|
||||
GDClaim fromClaim = null;
|
||||
GDClaim toClaim = this.dataStore.getClaimAt(toLocation);
|
||||
if (playerData != null) {
|
||||
fromClaim = this.dataStore.getClaimAtPlayer(playerData, fromLocation);
|
||||
} else {
|
||||
fromClaim = this.dataStore.getClaimAt(fromLocation);
|
||||
}
|
||||
|
||||
if (GDFlags.ENTER_CLAIM && !enterBlacklisted && playerData != null && playerData.lastClaim != null) {
|
||||
final GDClaim lastClaim = (GDClaim) playerData.lastClaim.get();
|
||||
if (lastClaim != null && lastClaim != fromClaim) {
|
||||
if (GDPermissionManager.getInstance().getFinalPermission(event, toLocation, toClaim, GDPermissions.ENTER_CLAIM, player, player, player, TrustTypes.ACCESSOR, false) == Tristate.FALSE) {
|
||||
Location claimCorner = new Location(toClaim.getWorld(), toClaim.lesserBoundaryCorner.getX(), player.getLocation().getY(), toClaim.greaterBoundaryCorner.getZ());
|
||||
player.teleport(claimCorner);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fromClaim == toClaim) {
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
return;
|
||||
}
|
||||
|
||||
GDBorderClaimEvent gpEvent = new GDBorderClaimEvent(user, fromClaim, toClaim);
|
||||
if (toClaim.isUserTrusted(player, TrustTypes.ACCESSOR)) {
|
||||
GriefDefender.getEventManager().post(gpEvent);
|
||||
if (gpEvent.cancelled()) {
|
||||
if (player.getVehicle() != null) {
|
||||
/* final Vehicle vehicle = (Vehicle) player.getVehicle();
|
||||
final EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
|
||||
final net.minecraft.server.Entity nmsVehicle = ((CraftEntity) vehicle).getHandle();
|
||||
final BlockPosition fromBlockPos = VecHelper.toBlockPos(event.getFrom());
|
||||
nmsVehicle.setPositionRotation(fromBlockPos, nmsVehicle.lastYaw, nmsVehicle.lastPitch);
|
||||
nmsPlayer.playerConnection.networkManager.sendPacket(new PacketPlayOutVehicleMove(nmsVehicle));*/
|
||||
}
|
||||
event.setCancelled(true);
|
||||
final Component cancelMessage = gpEvent.getMessage().orElse(null);
|
||||
if (player != null && cancelMessage != null) {
|
||||
TextAdapter.sendComponent(player, cancelMessage);
|
||||
}
|
||||
} else {
|
||||
if (playerData != null) {
|
||||
final boolean showGpPrefix = GriefDefenderPlugin.getGlobalConfig().getConfig().message.enterExitShowGdPrefix;
|
||||
playerData.lastClaim = new WeakReference<>(toClaim);
|
||||
TextComponent welcomeMessage = (TextComponent) gpEvent.getEnterMessage().orElse(null);
|
||||
if (welcomeMessage != null && !welcomeMessage.equals(TextComponent.empty())) {
|
||||
ChatType chatType = gpEvent.getEnterMessageChatType();
|
||||
if (chatType == ChatTypes.ACTION_BAR) {
|
||||
TextAdapter.sendActionBar(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(welcomeMessage)
|
||||
.build());
|
||||
} else {
|
||||
TextAdapter.sendComponent(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(welcomeMessage)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
Component farewellMessage = gpEvent.getExitMessage().orElse(null);
|
||||
if (farewellMessage != null && !farewellMessage.equals(TextComponent.empty()) && !farewellMessage.equals("")) {
|
||||
ChatType chatType = gpEvent.getExitMessageChatType();
|
||||
if (chatType == ChatTypes.ACTION_BAR) {
|
||||
TextAdapter.sendActionBar(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(farewellMessage)
|
||||
.build());
|
||||
} else {
|
||||
TextAdapter.sendComponent(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(farewellMessage)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
if (toClaim.isInTown()) {
|
||||
playerData.inTown = true;
|
||||
} else {
|
||||
playerData.inTown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
return;
|
||||
}
|
||||
|
||||
if (fromClaim != toClaim) {
|
||||
boolean enterCancelled = false;
|
||||
boolean exitCancelled = false;
|
||||
// enter
|
||||
if (GDFlags.ENTER_CLAIM && !enterBlacklisted && GDPermissionManager.getInstance().getFinalPermission(event, toLocation, toClaim, GDPermissions.ENTER_CLAIM, player, player, player) == Tristate.FALSE) {
|
||||
enterCancelled = true;
|
||||
gpEvent.cancelled(true);
|
||||
}
|
||||
|
||||
// exit
|
||||
if (GDFlags.EXIT_CLAIM && !exitBlacklisted && GDPermissionManager.getInstance().getFinalPermission(event, fromLocation, fromClaim, GDPermissions.EXIT_CLAIM, player, player, player) == Tristate.FALSE) {
|
||||
exitCancelled = true;
|
||||
gpEvent.cancelled(true);
|
||||
}
|
||||
|
||||
GriefDefender.getEventManager().post(gpEvent);
|
||||
if (gpEvent.cancelled()) {
|
||||
final Component cancelMessage = gpEvent.getMessage().orElse(null);
|
||||
if (exitCancelled) {
|
||||
if (cancelMessage != null) {
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(fromClaim, player, MessageCache.getInstance().PERMISSION_CLAIM_EXIT);
|
||||
}
|
||||
} else if (enterCancelled) {
|
||||
if (cancelMessage != null) {
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(toClaim, player, MessageCache.getInstance().PERMISSION_CLAIM_ENTER);
|
||||
}
|
||||
}
|
||||
|
||||
if (cancelMessage != null) {
|
||||
TextAdapter.sendComponent(player, cancelMessage);
|
||||
}
|
||||
|
||||
if (player.getVehicle() != null) {
|
||||
/* final Vehicle vehicle = (Vehicle) player.getVehicle();
|
||||
final EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
|
||||
final net.minecraft.server.Entity nmsVehicle = ((CraftEntity) vehicle).getHandle();
|
||||
final BlockPosition fromBlockPos = VecHelper.toBlockPos(event.getFrom());
|
||||
nmsVehicle.setPositionRotation(fromBlockPos, nmsVehicle.lastYaw, nmsVehicle.lastPitch);
|
||||
nmsPlayer.playerConnection.networkManager.sendPacket(new PacketPlayOutVehicleMove(nmsVehicle));*/
|
||||
}
|
||||
event.setCancelled(true);
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
return;
|
||||
}
|
||||
|
||||
if (playerData != null) {
|
||||
final boolean showGpPrefix = GriefDefenderPlugin.getGlobalConfig().getConfig().message.enterExitShowGdPrefix;
|
||||
playerData.lastClaim = new WeakReference<>(toClaim);
|
||||
Component welcomeMessage = gpEvent.getEnterMessage().orElse(null);
|
||||
if (welcomeMessage != null && !welcomeMessage.equals(TextComponent.empty()) && !welcomeMessage.equals("")) {
|
||||
ChatType chatType = gpEvent.getEnterMessageChatType();
|
||||
if (chatType == ChatTypes.ACTION_BAR) {
|
||||
TextAdapter.sendActionBar(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(welcomeMessage)
|
||||
.build());
|
||||
} else {
|
||||
TextAdapter.sendComponent(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(welcomeMessage)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
Component farewellMessage = gpEvent.getExitMessage().orElse(null);
|
||||
if (farewellMessage != null && !farewellMessage.equals(TextComponent.empty()) && !farewellMessage.equals("")) {
|
||||
ChatType chatType = gpEvent.getExitMessageChatType();
|
||||
if (chatType == ChatTypes.ACTION_BAR) {
|
||||
TextAdapter.sendActionBar(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(farewellMessage)
|
||||
.build());
|
||||
} else {
|
||||
TextAdapter.sendComponent(player, TextComponent.builder("")
|
||||
.append(showGpPrefix ? GriefDefenderPlugin.GD_TEXT : TextComponent.empty())
|
||||
.append(farewellMessage)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
if (toClaim.isInTown()) {
|
||||
playerData.inTown = true;
|
||||
} else {
|
||||
playerData.inTown = false;
|
||||
}
|
||||
|
||||
checkPlayerFlight(event, player, playerData, fromClaim, toClaim);
|
||||
}
|
||||
}
|
||||
|
||||
GDTimings.ENTITY_MOVE_EVENT.stopTiming();
|
||||
}
|
||||
|
||||
private void checkPlayerFlight(PlayerMoveEvent event, Player player, GDPlayerData playerData, GDClaim fromClaim, GDClaim toClaim) {
|
||||
final GameMode gameMode = player.getGameMode();
|
||||
if (gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fromClaim == toClaim || !player.isFlying()) {
|
||||
// only handle player-fly in enter/exit
|
||||
return;
|
||||
}
|
||||
|
||||
final Boolean noFly = GDPermissionManager.getInstance().getInternalOptionValue(TypeToken.of(Boolean.class), playerData.getSubject(), Options.PLAYER_DENY_FLIGHT, toClaim);
|
||||
final boolean adminFly = player.hasPermission(GDPermissions.BYPASS_OPTION);
|
||||
final boolean ownerFly = toClaim.isBasicClaim() ? player.hasPermission(GDPermissions.USER_OPTION_PERK_OWNER_FLY_BASIC) : toClaim.isTown() ? player.hasPermission(GDPermissions.USER_OPTION_PERK_OWNER_FLY_TOWN) : false;
|
||||
if (player.getUniqueId().equals(toClaim.getOwnerUniqueId()) && ownerFly) {
|
||||
return;
|
||||
}
|
||||
if (!adminFly && noFly) {
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
playerData.ignoreFallDamage = true;
|
||||
GriefDefenderPlugin.sendMessage(player, MessageCache.getInstance().OPTION_PLAYER_DENY_FLIGHT);
|
||||
}
|
||||
CommonEntityEventHandler.getInstance().onEntityMove(event, event.getFrom(), event.getTo(), event.getPlayer());
|
||||
}
|
||||
|
||||
private void onPlayerHandleShovelAction(PlayerInteractEvent event, Block clickedBlock, Player player, ItemStack itemInHand, GDPlayerData playerData) {
|
||||
@ -1780,25 +1513,6 @@ private GDClaim findNearbyClaim(Player player) {
|
||||
return claim;
|
||||
}
|
||||
|
||||
private void sendInteractEntityDenyMessage(ItemStack playerItem, Entity entity, GDClaim claim, Player player) {
|
||||
if (entity instanceof Player || (claim.getData() != null && !claim.getData().allowDenyMessages())) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String entityId = entity.getType().getName() == null ? entity.getType().name().toLowerCase() : entity.getType().getName();
|
||||
if (playerItem == null || playerItem.getType() == Material.AIR) {
|
||||
final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_INTERACT_ENTITY, ImmutableMap.of(
|
||||
"player", claim.getOwnerName(),
|
||||
"entity", entityId));
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(claim, player, message);
|
||||
} else {
|
||||
final Component message = GriefDefenderPlugin.getInstance().messageData.getMessage(MessageStorage.PERMISSION_INTERACT_ITEM_ENTITY, ImmutableMap.of(
|
||||
"item", ItemTypeRegistryModule.getInstance().getNMSKey(playerItem),
|
||||
"entity", entityId));
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(claim, player, message);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendInteractBlockDenyMessage(ItemStack playerItem, Block block, GDClaim claim, Player player, GDPlayerData playerData) {
|
||||
if (claim.getData() != null && !claim.getData().allowDenyMessages()) {
|
||||
return;
|
||||
|
@ -282,8 +282,7 @@ private Tristate getUserPermission(GDPermissionHolder holder, Claim claim, Strin
|
||||
for (Claim parentClaim : inheritParents) {
|
||||
GDClaim parent = (GDClaim) parentClaim;
|
||||
// check parent context
|
||||
contexts.add(parent.getContext());
|
||||
|
||||
contexts.add(parent.getContext());
|
||||
Tristate value = PermissionUtil.getInstance().getPermissionValue((GDClaim) claim, holder, permission, contexts);
|
||||
if (value != Tristate.UNDEFINED) {
|
||||
return processResult(claim, permission, value, holder);
|
||||
@ -300,43 +299,46 @@ private Tristate getUserPermission(GDPermissionHolder holder, Claim claim, Strin
|
||||
}
|
||||
|
||||
if (holder == GriefDefenderPlugin.DEFAULT_HOLDER) {
|
||||
return getFlagDefaultPermission(claim, permission);
|
||||
return getFlagDefaultPermission(claim, permission, contexts);
|
||||
}
|
||||
|
||||
return getClaimFlagPermission(claim, permission);
|
||||
return getClaimFlagPermission(claim, permission, contexts);
|
||||
}
|
||||
|
||||
private Tristate getClaimFlagPermission(Claim claim, String permission) {
|
||||
Set<Context> contexts = new HashSet<>();
|
||||
contexts.add(claim.getContext());
|
||||
contexts.add(claim.getType().getContext());
|
||||
contexts.addAll(this.eventContexts);
|
||||
return this.getClaimFlagPermission(claim, permission, new HashSet<>());
|
||||
}
|
||||
|
||||
private Tristate getClaimFlagPermission(Claim claim, String permission, Set<Context> contexts) {
|
||||
if (contexts.isEmpty()) {
|
||||
final List<Claim> inheritParents = claim.getInheritedParents();
|
||||
contexts.addAll(this.eventContexts);
|
||||
for (Claim parentClaim : inheritParents) {
|
||||
GDClaim parent = (GDClaim) parentClaim;
|
||||
// check parent context
|
||||
contexts.add(parent.getContext());
|
||||
Tristate value = PermissionUtil.getInstance().getPermissionValue((GDClaim) claim, GriefDefenderPlugin.DEFAULT_HOLDER, permission, contexts);
|
||||
if (value != Tristate.UNDEFINED) {
|
||||
return processResult(claim, permission, value, GriefDefenderPlugin.DEFAULT_HOLDER);
|
||||
}
|
||||
|
||||
contexts.remove(parent.getContext());
|
||||
}
|
||||
contexts.add(claim.getContext());
|
||||
}
|
||||
|
||||
Tristate value = PermissionUtil.getInstance().getPermissionValue((GDClaim) claim, GriefDefenderPlugin.DEFAULT_HOLDER, permission, contexts);
|
||||
if (value != Tristate.UNDEFINED) {
|
||||
return processResult(claim, permission, value, GriefDefenderPlugin.DEFAULT_HOLDER);
|
||||
}
|
||||
|
||||
return getFlagDefaultPermission(claim, permission);
|
||||
return getFlagDefaultPermission(claim, permission, contexts);
|
||||
}
|
||||
|
||||
// Only uses world and claim type contexts
|
||||
private Tristate getFlagDefaultPermission(Claim claim, String permission) {
|
||||
final GDClaim gpClaim = (GDClaim) claim;
|
||||
// Fallback to defaults
|
||||
Set<Context> contexts = new HashSet<>();
|
||||
if (gpClaim.parent != null && claim.getData().doesInheritParent()) {
|
||||
if (gpClaim.parent.parent != null && gpClaim.parent.getData().doesInheritParent()) {
|
||||
claim = gpClaim.parent.parent;
|
||||
} else {
|
||||
claim = gpClaim.parent;
|
||||
}
|
||||
}
|
||||
|
||||
private Tristate getFlagDefaultPermission(Claim claim, String permission, Set<Context> contexts) {
|
||||
contexts.add(claim.getDefaultTypeContext());
|
||||
contexts.add(ClaimContexts.GLOBAL_DEFAULT_CONTEXT);
|
||||
//contexts.add(claim.getWorld().getContext());
|
||||
contexts.addAll(this.eventContexts);
|
||||
Tristate value = PermissionUtil.getInstance().getPermissionValue((GDClaim) claim, GriefDefenderPlugin.DEFAULT_HOLDER, permission, contexts);
|
||||
if (value != Tristate.UNDEFINED) {
|
||||
return processResult(claim, permission, value, GriefDefenderPlugin.DEFAULT_HOLDER);
|
||||
|
@ -42,6 +42,8 @@ public class GDPermissions {
|
||||
public static final String COMMAND_GIVE_PET = "griefdefender.user.claim.command.give.pet";
|
||||
public static final String COMMAND_CLAIM_BANK = "griefdefender.user.claim.command.bank";
|
||||
public static final String COMMAND_CLAIM_BUY = "griefdefender.user.claim.command.buy";
|
||||
public static final String COMMAND_CLAIM_CONTRACT = "griefdefender.user.claim.command.contract";
|
||||
public static final String COMMAND_CLAIM_EXPAND = "griefdefender.user.claim.command.expand";
|
||||
public static final String COMMAND_CLAIM_INFO_OTHERS = "griefdefender.user.claim.command.info.others";
|
||||
public static final String COMMAND_CLAIM_INFO_BASE = "griefdefender.user.claim.command.info.base";
|
||||
public static final String COMMAND_CLAIM_INFO_TELEPORT_OTHERS = "griefdefender.user.claim.command.info.teleport.others";
|
||||
|
@ -88,6 +88,7 @@ public boolean getDefaultClaimTypeValue(ClaimType type) {
|
||||
case "block-place" :
|
||||
case "collide-block" :
|
||||
case "collide-entity" :
|
||||
case "entity-damage" :
|
||||
case "explosion-block" :
|
||||
case "explosion-entity" :
|
||||
case "fire-spread" :
|
||||
|
@ -27,7 +27,6 @@
|
||||
import com.griefdefender.GriefDefenderPlugin;
|
||||
import com.griefdefender.api.Tristate;
|
||||
import com.griefdefender.api.permission.option.Option;
|
||||
import com.griefdefender.api.permission.option.Options;
|
||||
import com.griefdefender.api.permission.option.type.CreateModeType;
|
||||
import com.griefdefender.api.permission.option.type.CreateModeTypes;
|
||||
import com.griefdefender.api.permission.option.type.GameModeType;
|
||||
|
@ -659,7 +659,7 @@ public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, Str
|
||||
}
|
||||
}
|
||||
// If we get here, continue on normally
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -689,7 +689,7 @@ public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, Str
|
||||
}
|
||||
}
|
||||
// If we get here, continue on normally
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
import com.griefdefender.api.claim.ClaimTypes;
|
||||
import com.griefdefender.api.permission.Context;
|
||||
import com.griefdefender.api.permission.flag.Flag;
|
||||
import com.griefdefender.api.permission.flag.Flags;
|
||||
import com.griefdefender.api.permission.option.Option;
|
||||
import com.griefdefender.claim.GDClaim;
|
||||
import com.griefdefender.claim.GDClaimManager;
|
||||
@ -53,6 +54,7 @@
|
||||
import com.griefdefender.event.GDRemoveClaimEvent;
|
||||
import com.griefdefender.internal.util.VecHelper;
|
||||
import com.griefdefender.permission.GDPermissions;
|
||||
import com.griefdefender.permission.flag.FlagContexts;
|
||||
import com.griefdefender.permission.option.GDOption;
|
||||
import com.griefdefender.registry.FlagRegistryModule;
|
||||
import com.griefdefender.registry.OptionRegistryModule;
|
||||
@ -386,6 +388,22 @@ private void setDefaultFlags(Set<Context> contexts, Map<String, Boolean> default
|
||||
continue;
|
||||
}
|
||||
PermissionUtil.getInstance().setTransientPermission(GriefDefenderPlugin.DEFAULT_HOLDER, GDPermissions.FLAG_BASE + "." + mapEntry.getKey(), mapEntry.getValue(), contexts);
|
||||
if (flag == Flags.ENTITY_DAMAGE) {
|
||||
// allow monsters to be attacked by default
|
||||
contexts.add(FlagContexts.TARGET_TYPE_MONSTER);
|
||||
PermissionUtil.getInstance().setTransientPermission(GriefDefenderPlugin.DEFAULT_HOLDER, GDPermissions.FLAG_BASE + "." + mapEntry.getKey(), true, contexts);
|
||||
contexts.remove(FlagContexts.TARGET_TYPE_MONSTER);
|
||||
// deny item frame damage by default
|
||||
contexts.add(FlagContexts.TARGET_ITEM_FRAME);
|
||||
PermissionUtil.getInstance().setTransientPermission(GriefDefenderPlugin.DEFAULT_HOLDER, GDPermissions.FLAG_BASE + "." + mapEntry.getKey(), false, contexts);
|
||||
contexts.remove(FlagContexts.TARGET_ITEM_FRAME);
|
||||
}
|
||||
if (flag == Flags.INTERACT_ENTITY_SECONDARY) {
|
||||
// deny item frame rotation by default
|
||||
contexts.add(FlagContexts.TARGET_ITEM_FRAME);
|
||||
PermissionUtil.getInstance().setTransientPermission(GriefDefenderPlugin.DEFAULT_HOLDER, GDPermissions.FLAG_BASE + "." + mapEntry.getKey(), false, contexts);
|
||||
contexts.remove(FlagContexts.TARGET_ITEM_FRAME);
|
||||
}
|
||||
}
|
||||
PermissionUtil.getInstance().refreshCachedData(GriefDefenderPlugin.DEFAULT_HOLDER);
|
||||
});
|
||||
|
@ -60,6 +60,8 @@
|
||||
|
||||
public class PlayerUtil {
|
||||
|
||||
private static BlockFace[] faces = { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST};
|
||||
|
||||
private static PlayerUtil instance;
|
||||
|
||||
public static PlayerUtil getInstance() {
|
||||
@ -70,6 +72,20 @@ public static PlayerUtil getInstance() {
|
||||
instance = new PlayerUtil();
|
||||
}
|
||||
|
||||
public BlockFace getBlockFace(Player player) {
|
||||
return faces[Math.round(player.getLocation().getYaw() / 90f) & 0x3].getOppositeFace();
|
||||
}
|
||||
|
||||
public BlockFace getBlockFace(String param) {
|
||||
BlockFace face = null;
|
||||
try {
|
||||
face = BlockFace.valueOf(param);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// ignore
|
||||
}
|
||||
return face;
|
||||
}
|
||||
|
||||
public ClaimType getClaimTypeFromShovel(ShovelType shovelMode) {
|
||||
if (shovelMode == ShovelTypes.ADMIN) {
|
||||
return ClaimTypes.ADMIN;
|
||||
|
@ -9,9 +9,9 @@
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:api:1.0.0",
|
||||
"sha1": "eb8a6efe3e4c6af9ed5e0100fd5c94e0a0ccd762",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar"
|
||||
"sha1": "7b9e85b96e5d4e075b69173d719f7d0eabf4703b",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar"
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:reflect-helper:1.0",
|
||||
|
@ -9,9 +9,9 @@
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:api:1.0.0",
|
||||
"sha1": "eb8a6efe3e4c6af9ed5e0100fd5c94e0a0ccd762",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar"
|
||||
"sha1": "7b9e85b96e5d4e075b69173d719f7d0eabf4703b",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar"
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:reflect-helper:1.0",
|
||||
|
@ -9,9 +9,9 @@
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:api:1.0.0",
|
||||
"sha1": "eb8a6efe3e4c6af9ed5e0100fd5c94e0a0ccd762",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar"
|
||||
"sha1": "7b9e85b96e5d4e075b69173d719f7d0eabf4703b",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar"
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:reflect-helper:1.0",
|
||||
|
@ -9,9 +9,9 @@
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:api:1.0.0",
|
||||
"sha1": "eb8a6efe3e4c6af9ed5e0100fd5c94e0a0ccd762",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar"
|
||||
"sha1": "7b9e85b96e5d4e075b69173d719f7d0eabf4703b",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar"
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:reflect-helper:1.0",
|
||||
|
@ -9,9 +9,9 @@
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:api:1.0.0",
|
||||
"sha1": "eb8a6efe3e4c6af9ed5e0100fd5c94e0a0ccd762",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar"
|
||||
"sha1": "7b9e85b96e5d4e075b69173d719f7d0eabf4703b",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar"
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:reflect-helper:1.0",
|
||||
|
@ -9,9 +9,9 @@
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:api:1.0.0",
|
||||
"sha1": "eb8a6efe3e4c6af9ed5e0100fd5c94e0a0ccd762",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190823.060031-8.jar"
|
||||
"sha1": "7b9e85b96e5d4e075b69173d719f7d0eabf4703b",
|
||||
"path": "com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar",
|
||||
"url": "https://repo.glaremasters.me/repository/bloodshot/com/griefdefender/api/1.0.0-SNAPSHOT/api-1.0.0-20190828.014803-9.jar"
|
||||
},
|
||||
{
|
||||
"name": "com.griefdefender:reflect-helper:1.0",
|
||||
|
Loading…
Reference in New Issue
Block a user