update
This commit is contained in:
@@ -2,12 +2,18 @@ package lnmpro.Commands;
|
||||
|
||||
import lnmpro.Main;
|
||||
import lnmpro.Utils.Kits;
|
||||
import lnmpro.Utils.SchematicPlacer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -26,6 +32,8 @@ public class AcceptDuelCommand implements CommandExecutor, TabCompleter {
|
||||
if (sender instanceof Player player) {
|
||||
if (player.hasMetadata("DueledBy")) {
|
||||
Kits kitManager = new Kits(plugin);
|
||||
SchematicPlacer schematic = new SchematicPlacer(plugin);
|
||||
|
||||
UUID targetUUID = UUID.fromString(player.getMetadata("DueledBy").get(0).asString());
|
||||
Player enemy = Bukkit.getPlayer(targetUUID);
|
||||
String gamemode = player.getMetadata("DueledWithGamemode").get(0).asString();
|
||||
@@ -33,7 +41,40 @@ public class AcceptDuelCommand implements CommandExecutor, TabCompleter {
|
||||
player.sendMessage("cica " + gamemode);
|
||||
player.removeMetadata("DueledBy", plugin);
|
||||
player.removeMetadata("DueledWithGamemode", plugin);
|
||||
player.getInventory().setContents(kitManager.getMaceKit(player).getContents());
|
||||
|
||||
player.getInventory().clear();
|
||||
enemy.getInventory().clear();
|
||||
player.getInventory().setContents(kitManager.getAxeKit(player).getContents());
|
||||
enemy.getInventory().setContents(kitManager.getAxeKit(player).getContents());
|
||||
|
||||
World world = Bukkit.getWorld("world");
|
||||
int x = 1000;
|
||||
int y = 0;
|
||||
int z = -2000;
|
||||
|
||||
schematic.placeSchematic(world, x, y, z, "football");
|
||||
Location playerLoc = new Location(world, x + 19.5, y + 0.5, z + 0.5, 90, 0);
|
||||
Location enemyLoc = new Location(world, x - 17.5, y + 0.5, z + 0.5, -90, 0);
|
||||
|
||||
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(potionEffect.getType());
|
||||
}
|
||||
for (PotionEffect potionEffect : enemy.getActivePotionEffects()) {
|
||||
enemy.removePotionEffect(potionEffect.getType());
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20, 1), true);
|
||||
enemy.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20, 1), true);
|
||||
player.teleport(playerLoc);
|
||||
enemy.teleport(enemyLoc);
|
||||
player.setHealth(20D);
|
||||
enemy.setHealth(20D);
|
||||
player.setFoodLevel(20);
|
||||
enemy.setFoodLevel(20);
|
||||
player.setSaturation(5);
|
||||
enemy.setSaturation(5);
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
enemy.setGameMode(GameMode.ADVENTURE);
|
||||
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("nem vagy player nem fog sikerulni");
|
||||
|
||||
Reference in New Issue
Block a user