mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-09-25 04:12:51 +02:00
Fix NPE in findOverlappingClaims.
* Fix safe teleport. * Bump version to 1.2.1
This commit is contained in:
parent
e9377d4935
commit
d6f214db45
@ -368,6 +368,7 @@ public static MessageCache getInstance() {
|
||||
public Component SCHEMATIC_CREATE_FAIL;
|
||||
public Component SCHEMATIC_NONE;
|
||||
public Component SPAWN_NOT_SET;
|
||||
public Component TELEPORT_NO_SAFE_LOCATION;
|
||||
public Component TITLE_ACCESSOR;
|
||||
public Component TITLE_ALL;
|
||||
public Component TITLE_BUILDER;
|
||||
@ -717,6 +718,7 @@ public void loadCache() {
|
||||
SCHEMATIC_CREATE_FAIL = MessageStorage.MESSAGE_DATA.getMessage("schematic-create-fail");
|
||||
SCHEMATIC_NONE = MessageStorage.MESSAGE_DATA.getMessage("schematic-none");
|
||||
SPAWN_NOT_SET = MessageStorage.MESSAGE_DATA.getMessage("spawn-not-set");
|
||||
TELEPORT_NO_SAFE_LOCATION = MessageStorage.MESSAGE_DATA.getMessage("teleport-no-safe-location");
|
||||
TITLE_ACCESSOR = MessageStorage.MESSAGE_DATA.getMessage("title-accessor");
|
||||
TITLE_ALL = MessageStorage.MESSAGE_DATA.getMessage("title-all");
|
||||
TITLE_BUILDER = MessageStorage.MESSAGE_DATA.getMessage("title-builder");
|
||||
|
@ -458,7 +458,11 @@ public Map<UUID, GDPlayerData> getPlayerDataMap() {
|
||||
public Set<Claim> findOverlappingClaims(Claim claim) {
|
||||
Set<Claim> claimSet = new HashSet<>();
|
||||
for (Long chunkHash : claim.getChunkHashes()) {
|
||||
for (Claim chunkClaim : this.chunksToClaimsMap.get(chunkHash)) {
|
||||
final Set<Claim> chunkClaims = this.chunksToClaimsMap.get(chunkHash);
|
||||
if (chunkClaims == null) {
|
||||
continue;
|
||||
}
|
||||
for (Claim chunkClaim : chunkClaims) {
|
||||
if (!chunkClaim.equals(claim) && (claim.overlaps(chunkClaim) || chunkClaim.overlaps(claim))) {
|
||||
claimSet.add(chunkClaim);
|
||||
}
|
||||
|
@ -98,6 +98,7 @@
|
||||
import com.griefdefender.permission.ui.UIHelper;
|
||||
import com.griefdefender.text.action.GDCallbackHolder;
|
||||
import com.griefdefender.util.PermissionUtil;
|
||||
import com.griefdefender.util.PlayerUtil;
|
||||
import com.griefdefender.util.TaskUtil;
|
||||
|
||||
import net.kyori.text.Component;
|
||||
@ -1018,13 +1019,19 @@ public static Consumer<CommandSender> createTeleportConsumer(CommandSender src,
|
||||
}
|
||||
}
|
||||
|
||||
player.teleport(location, TeleportCause.PLUGIN);
|
||||
};
|
||||
}
|
||||
final double safeY = player.getWorld().getHighestBlockYAt(location);
|
||||
location.setY(safeY);
|
||||
int currentY = location.getBlockY();
|
||||
while (currentY < player.getWorld().getMaxHeight()) {
|
||||
if (PlayerUtil.getInstance().isSafeLocation(location)) {
|
||||
player.teleport(location, TeleportCause.PLUGIN);
|
||||
return;
|
||||
}
|
||||
currentY++;
|
||||
location.setY(currentY);
|
||||
}
|
||||
|
||||
public static Consumer<CommandSender> createForceTeleportConsumer(Player player, Location location) {
|
||||
return teleport -> {
|
||||
player.teleport(location, TeleportCause.PLUGIN);
|
||||
TextAdapter.sendComponent(player, MessageCache.getInstance().TELEPORT_NO_SAFE_LOCATION);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
import com.griefdefender.cache.PermissionHolderCache;
|
||||
import com.griefdefender.claim.GDClaim;
|
||||
import com.griefdefender.configuration.MessageStorage;
|
||||
import com.griefdefender.internal.util.NMSUtil;
|
||||
import com.griefdefender.internal.visual.ClaimVisual;
|
||||
import com.griefdefender.internal.visual.GDClaimVisualType;
|
||||
import com.griefdefender.permission.GDPermissionUser;
|
||||
@ -44,8 +45,11 @@
|
||||
import net.kyori.text.format.TextColor;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -181,4 +185,20 @@ public void sendInteractEntityDenyMessage(GDClaim claim, Player player, ItemStac
|
||||
GriefDefenderPlugin.sendClaimDenyMessage(claim, player, message);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSafeLocation(Location location) {
|
||||
final Block currentBlock = location.getBlock();
|
||||
final Block aboveBlock = currentBlock.getRelative(BlockFace.UP);
|
||||
final Block belowBlock =currentBlock.getRelative(BlockFace.DOWN);
|
||||
if (!NMSUtil.getInstance().isBlockTransparent(currentBlock)) {
|
||||
return false;
|
||||
}
|
||||
if (!NMSUtil.getInstance().isBlockTransparent(aboveBlock)) {
|
||||
return false;
|
||||
}
|
||||
if (!belowBlock.getType().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -579,6 +579,7 @@ GriefDefender {
|
||||
tax-claim-paid-partial="&aThe tax debt of '&6{amount}&a' has been partially paid. In order to unfreeze your claim, the remaining tax owed balance of '&6{balance}&a' must be paid."
|
||||
tax-info="&aYour next scheduled tax payment of &6{amount}&a will be withdrawn from your account on &b{date}&a."
|
||||
tax-past-due="&cYou currently have a past due tax balance of &a{balance}&c that must be paid by &b{date}&c. Failure to pay off your tax balance will result in losing your property."
|
||||
teleport-no-safe-location="&cNo safe location found in claim to teleport!\n&aUse the '&f/claiminfo&a' command to set a safe spawn point instead."
|
||||
title-accessor=ACCESSOR
|
||||
title-all=ALL
|
||||
title-builder=BUILDER
|
||||
|
@ -576,6 +576,7 @@ GriefDefender {
|
||||
tax-claim-paid-partial="&aLa dette de taxe de '&6{amount}&a' a été partiellement payée. Pour lever la mise en demeure de la protection, le reste de la taxe due de '&6{balance}&a' doit être payé."
|
||||
tax-info="&aTon prélèvement de taxe d'un montant de &6{amount}&a va être prélevé depuis ton compte le &b{date}&a."
|
||||
tax-past-due="&cTu as actuellement un défaut de paiement passé de taxe de &a{balance}&c qui nécessite d'être payé pour le &b{date}&c. L'échec de paiement de cette taxe entrainera la perte de la propriété."
|
||||
teleport-no-safe-location="&cAucun emplacement sûr trouvé dans la protection pour la téléportation.\n&aUtilise la commande '&f/claiminfo&a' pour définir un point d'apparition sûr."
|
||||
title-accessor=ACCÉDANT
|
||||
title-all=TOUS
|
||||
title-builder=CONSTRUTEUR
|
||||
|
@ -579,6 +579,7 @@ GriefDefender {
|
||||
tax-claim-paid-partial="&aЗадолженность по налогам в размере '&6{amount}&a' частично оплачена. Чтобы разморозить регион, остаток долга в размере '&6{balance}&a' должен быть уплачен."
|
||||
tax-info="&aСледующая выплата по налогам в размере &6{amount}&a будет списана с вашего счёта &b{date}&a."
|
||||
tax-past-due="&cУ вас есть задолженность по налогам в размере &a{balance}&c, которая должна быть выплачена до &b{date}&c. В случае неуплаты ваша собственность будет потеряна."
|
||||
teleport-no-safe-location="&cВ регионе не найдено безопасных мест для телепортации!\n&aВоспользуйтесь '&f/claiminfo&a', чтобы установить безопасную точку для возрождения/телепортации."
|
||||
title-accessor=ДОСТУП
|
||||
title-all=ВСЕ
|
||||
title-builder=СТРОИТЕЛЬСТВО
|
||||
|
@ -3,5 +3,5 @@ main: com.griefdefender.GDBootstrap
|
||||
softdepend: [WorldEdit, WorldGuard, Vault]
|
||||
depend: [LuckPerms]
|
||||
load: STARTUP
|
||||
version: '1.2.0'
|
||||
version: '1.2.1'
|
||||
api-version: 1.13
|
||||
|
Loading…
Reference in New Issue
Block a user