Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public void onInteract(@NotNull PlayerInteractEntityEvent event) {
if (!player.isSneaking()) return;
if (!(event.getRightClicked() instanceof Player sendTo)) return;
if (!sendTo.isOnline()) return;
if (CONFIG.getBoolean("prevent-vanished-trading", true) && !sendTo.canSee(sendTo)) return;

cooldown.addCooldown(player, 100L);
Requests.addRequest(player, sendTo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public static void addRequest(@NotNull Player sender, @NotNull Player receiver)
return;
}

if (CONFIG.getBoolean("prevent-vanished-trading", true) && (!sender.canSee(sender) || !receiver.canSee(receiver))) {
MESSAGEUTILS.sendLang(sender, "commands.invalid-player", replacements);
return;
}

if (TOGGLED.getBoolean("toggled." + receiver.getUniqueId())) {
MESSAGEUTILS.sendLang(sender, "request.not-accepting", replacements);
return;
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ prevent-adding-items-when-inventory-full: true
# if enabled, players will not be able to trade if they have the same ip address
disallow-same-ip-trade: false

# if enabled, vanished players cannot trade or be traded with
prevent-vanished-trading: false

number-formatting:
# modes:
# 0 - formatted (customizable, look at the formatted part)
Expand Down