Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.
Merged
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
29 changes: 29 additions & 0 deletions src/main/java/fr/communaywen/core/commands/fun/ProutCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import fr.communaywen.core.credit.Feature;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scoreboard.Scoreboard;
Expand All @@ -15,6 +16,7 @@
import revxrsal.commands.annotation.Cooldown;
import revxrsal.commands.annotation.Description;
import revxrsal.commands.bukkit.annotation.CommandPermission;
import org.bukkit.entity.Boat;

import java.util.concurrent.TimeUnit;

Expand All @@ -35,6 +37,18 @@ public final class ProutCommand {
public void onCommand(Player player) {
player.sendMessage("§2Beuuurk, ça pue !");

if(player.isInsideVehicle()){
if(player.getVehicle() instanceof Boat){
Boat boat = (Boat) player.getVehicle();
Material boatMaterial = getBoatType(boat);
ItemStack itemBoat = new ItemStack(boatMaterial);
player.getVehicle().remove();
player.getWorld().dropItemNaturally(boat.getLocation(), itemBoat);

player.sendMessage("Votre bateau a coulé.");
}
}

// Make the player jump
final Vector currentVelocity = player.getVelocity();
currentVelocity.setY(0.55d);
Expand Down Expand Up @@ -78,4 +92,19 @@ private void addGlowingEffect(Player player) {

Bukkit.getScheduler().runTaskLater(AywenCraftPlugin.getInstance(), () -> finalTeam.removeEntry(player.getName()), 600L);
}

private Material getBoatType(Boat boat){
Comment thread
llextv marked this conversation as resolved.
switch(boat.getBoatType()){
case OAK -> {return Material.OAK_BOAT;}
case BIRCH -> {return Material.BIRCH_BOAT;}
case ACACIA -> {return Material.ACACIA_BOAT;}
case BAMBOO -> {return Material.BAMBOO_RAFT;}
case CHERRY -> {return Material.CHERRY_BOAT;}
case JUNGLE -> {return Material.JUNGLE_BOAT;}
case SPRUCE -> {return Material.SPRUCE_BOAT;}
case DARK_OAK -> {return Material.DARK_OAK_BOAT;}
case MANGROVE -> {return Material.MANGROVE_BOAT;}
default -> {return Material.OAK_BOAT;}
}
}
}