Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 75fb1272d6 |
@@ -64,7 +64,13 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.3.9</version>
|
||||
<version>7.4.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
13
pom.xml
13
pom.xml
@@ -63,10 +63,6 @@
|
||||
<id>enginehub</id>
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>multiverse-multiverse-releases</id>
|
||||
<url>https://repo.onarandombox.com/multiverse-releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@@ -80,7 +76,14 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldedit</groupId>
|
||||
<artifactId>worldedit-bukkit</artifactId>
|
||||
<version>7.3.9</version>
|
||||
<version>7.4.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.1.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package hu.jgj52.pvpcore.Commands;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import hu.jgj52.pvpcore.Main;
|
||||
import hu.jgj52.pvpcore.Utils.Database;
|
||||
import hu.jgj52.pvpcore.Utils.Kits;
|
||||
@@ -22,6 +23,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.title.Title;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.Duration;
|
||||
|
||||
import java.util.*;
|
||||
@@ -45,127 +48,155 @@ public class AcceptDuelCommand implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
|
||||
Database.QueryResult reqResult = null;
|
||||
Database.QueryResult reqResult;
|
||||
try {
|
||||
reqResult = plugin.db.from("pvpcore_duel_requests").eq("player", Objects.requireNonNull(Bukkit.getPlayer(args[0])).getUniqueId()).eq("enemy", player.getUniqueId()).execute().get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Map<String, Object> row = reqResult.data.get(0);
|
||||
if (!reqResult.isEmpty()) {
|
||||
Map<String, Object> row = reqResult.data.get(0);
|
||||
|
||||
Player enemy = Bukkit.getPlayer(args[0]);
|
||||
if (enemy == null) {
|
||||
player.sendMessage("§cA megadott játékos nem található.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (reqResult.isEmpty()) {
|
||||
player.sendMessage("§cNincs párbajkérelmed ettől a játékostól.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Kits kitManager = new Kits(plugin);
|
||||
SchematicManager schematic = new SchematicManager(plugin);
|
||||
|
||||
String gamemode = row.get("kit").toString();
|
||||
|
||||
Database.QueryResult result = null;
|
||||
try {
|
||||
result = plugin.db.from("pvpcore_kits")
|
||||
.eq("name", gamemode)
|
||||
.execute()
|
||||
.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Map<String, Object> kitRow = result.data.get(0);
|
||||
|
||||
player.getInventory().clear();
|
||||
enemy.getInventory().clear();
|
||||
World world = Bukkit.getWorld("arenas");
|
||||
boolean survival = Boolean.parseBoolean(kitRow.get("survival").toString());
|
||||
String arena = kitRow.get("arena").toString();
|
||||
int x = Integer.parseInt(kitRow.get("id").toString()) * 1000;
|
||||
int y = 0;
|
||||
int z;
|
||||
|
||||
if (plugin.usedArenas.isEmpty()) {
|
||||
z = 0;
|
||||
} else {
|
||||
z = min(plugin.usedArenas) - 1000;
|
||||
}
|
||||
|
||||
plugin.usedArenas.add(z);
|
||||
|
||||
schematic.placeSchematic(world, x, y, z, arena, true);
|
||||
Location playerLoc = new Location(world, x + 20.5, y, z + 0.5, 90, 0);
|
||||
Location enemyLoc = new Location(world, x - 20.5, y, 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);
|
||||
try {
|
||||
player.getInventory().setContents(kitManager.getKit(gamemode, player, false));
|
||||
enemy.getInventory().setContents(kitManager.getKit(gamemode, enemy, false));
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
player.setHealth(20D);
|
||||
enemy.setHealth(20D);
|
||||
player.setFoodLevel(20);
|
||||
enemy.setFoodLevel(20);
|
||||
player.setSaturation(5);
|
||||
enemy.setSaturation(5);
|
||||
player.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
enemy.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
|
||||
Map<String, Object> duelData = new HashMap<>();
|
||||
duelData.put("player", enemy.getUniqueId());
|
||||
duelData.put("enemy", player.getUniqueId());
|
||||
duelData.put("ft", row.get("ft"));
|
||||
duelData.put("kit", gamemode);
|
||||
duelData.put("started", System.currentTimeMillis());
|
||||
|
||||
plugin.db.from("pvpcore_duels").insert(duelData);
|
||||
plugin.db.from("pvpcore_duel_requests").eq("player", Objects.requireNonNull(Bukkit.getPlayer(args[0])).getUniqueId()).eq("enemy", player.getUniqueId()).delete();
|
||||
|
||||
new BukkitRunnable() {
|
||||
int countdown = 3;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (countdown > 0) {
|
||||
Component titleText = Component.text(String.valueOf(countdown), NamedTextColor.AQUA);
|
||||
Title title = Title.title(
|
||||
titleText,
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ZERO, Duration.ofSeconds(1), Duration.ZERO)
|
||||
);
|
||||
player.showTitle(title);
|
||||
enemy.showTitle(title);
|
||||
countdown--;
|
||||
} else {
|
||||
Title startTitle = Title.title(
|
||||
Component.text("§eA párbaj megkezdődött!"),
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ZERO, Duration.ofSeconds(2), Duration.ofSeconds(1))
|
||||
);
|
||||
player.showTitle(startTitle);
|
||||
enemy.showTitle(startTitle);
|
||||
cancel();
|
||||
}
|
||||
Player enemy = Bukkit.getPlayer(args[0]);
|
||||
if (enemy == null) {
|
||||
player.sendMessage("§cA megadott játékos nem található.");
|
||||
return true;
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 20L);
|
||||
|
||||
if (reqResult.isEmpty()) {
|
||||
player.sendMessage("§cNincs párbajkérelmed ettől a játékostól.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Kits kitManager = new Kits(plugin);
|
||||
SchematicManager schematic = new SchematicManager(plugin);
|
||||
|
||||
String gamemode = row.get("kit").toString();
|
||||
|
||||
Database.QueryResult result;
|
||||
try {
|
||||
result = plugin.db.from("pvpcore_kits")
|
||||
.eq("name", gamemode)
|
||||
.execute()
|
||||
.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Map<String, Object> kitRow = result.data.get(0);
|
||||
Database.QueryResult arenaResult;
|
||||
try {
|
||||
arenaResult = plugin.db.from("pvpcore_arenas").eq("id", Integer.parseInt(kitRow.get("arena").toString())).execute().get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Map<String, Object> arenaRow = arenaResult.data.get(0);
|
||||
|
||||
player.getInventory().clear();
|
||||
enemy.getInventory().clear();
|
||||
World world = Bukkit.getWorld("arenas");
|
||||
boolean survival = Boolean.parseBoolean(kitRow.get("survival").toString());
|
||||
String arena = arenaRow.get("name").toString();
|
||||
int x = Integer.parseInt(kitRow.get("id").toString()) * 1000;
|
||||
int y = 0;
|
||||
int z;
|
||||
|
||||
if (plugin.usedArenas.isEmpty()) {
|
||||
z = 0;
|
||||
} else {
|
||||
z = min(plugin.usedArenas) - 1000;
|
||||
}
|
||||
|
||||
plugin.usedArenas.add(z);
|
||||
|
||||
schematic.placeSchematic(world, x, y, z, arena, true);
|
||||
|
||||
com.google.gson.Gson gson = new com.google.gson.Gson();
|
||||
Type type = new TypeToken<List<List<List<Integer>>>>() {
|
||||
}.getType();
|
||||
List<List<List<Integer>>> regions = gson.fromJson(arenaRow.get("regions").toString(), type);
|
||||
|
||||
for (List<List<Integer>> region : regions) {
|
||||
List<Integer> pos1 = region.get(0);
|
||||
List<Integer> pos2 = region.get(1);
|
||||
|
||||
int x1 = pos1.get(0), y1 = pos1.get(1), z1 = pos1.get(2);
|
||||
int x2 = pos2.get(0), y2 = pos2.get(1), z2 = pos2.get(2);
|
||||
Location loc1 = new Location(world, x + x1, y + y1, z + z1);
|
||||
Location loc2 = new Location(world, x + x2, y + y2, z + z2);
|
||||
|
||||
schematic.createRegion(world, UUID.randomUUID().toString(), loc1, loc2);
|
||||
}
|
||||
|
||||
Location playerLoc = new Location(world, x + 20.5, y, z + 0.5, 90, 0);
|
||||
Location enemyLoc = new Location(world, x - 20.5, y, 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);
|
||||
try {
|
||||
player.getInventory().setContents(kitManager.getKit(gamemode, player, false));
|
||||
enemy.getInventory().setContents(kitManager.getKit(gamemode, enemy, false));
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
player.setHealth(20D);
|
||||
enemy.setHealth(20D);
|
||||
player.setFoodLevel(20);
|
||||
enemy.setFoodLevel(20);
|
||||
player.setSaturation(5);
|
||||
enemy.setSaturation(5);
|
||||
player.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
enemy.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
|
||||
Map<String, Object> duelData = new HashMap<>();
|
||||
duelData.put("player", enemy.getUniqueId());
|
||||
duelData.put("enemy", player.getUniqueId());
|
||||
duelData.put("ft", row.get("ft"));
|
||||
duelData.put("kit", gamemode);
|
||||
duelData.put("started", System.currentTimeMillis());
|
||||
|
||||
plugin.db.from("pvpcore_duels").insert(duelData);
|
||||
plugin.db.from("pvpcore_duel_requests").eq("player", Objects.requireNonNull(Bukkit.getPlayer(args[0])).getUniqueId()).eq("enemy", player.getUniqueId()).delete();
|
||||
|
||||
new BukkitRunnable() {
|
||||
int countdown = 3;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (countdown > 0) {
|
||||
Component titleText = Component.text(String.valueOf(countdown), NamedTextColor.AQUA);
|
||||
Title title = Title.title(
|
||||
titleText,
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ZERO, Duration.ofSeconds(1), Duration.ZERO)
|
||||
);
|
||||
player.showTitle(title);
|
||||
enemy.showTitle(title);
|
||||
countdown--;
|
||||
} else {
|
||||
Title startTitle = Title.title(
|
||||
Component.text("§eA párbaj megkezdődött!"),
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ZERO, Duration.ofSeconds(2), Duration.ofSeconds(1))
|
||||
);
|
||||
player.showTitle(startTitle);
|
||||
enemy.showTitle(startTitle);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 20L);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -122,26 +122,6 @@ public class DuelCommand implements CommandExecutor, TabCompleter {
|
||||
diasmpMeta.setDisplayName("§dDiaSMP");
|
||||
diasmp.setItemMeta(diasmpMeta);
|
||||
|
||||
ItemStack shieldlessuhc = new ItemStack(Material.PLAYER_HEAD);
|
||||
SkullMeta skullMeta = (SkullMeta) shieldlessuhc.getItemMeta();
|
||||
|
||||
PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID(), "Schicsial");
|
||||
|
||||
try {
|
||||
PlayerTextures textures = profile.getTextures();
|
||||
|
||||
textures.setSkin(new URL("https://textures.minecraft.net/texture/566a87460173adf067cb356ae200d030504378c552e3428b4774c4c11a599c24"));
|
||||
|
||||
profile.setTextures(textures);
|
||||
|
||||
skullMeta.setPlayerProfile((com.destroystokyo.paper.profile.PlayerProfile) profile);
|
||||
|
||||
skullMeta.setDisplayName("§eShieldlessUHC");
|
||||
shieldlessuhc.setItemMeta(skullMeta);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ItemStack pirosuveg = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
ItemMeta pirosuvegMeta = pirosuveg.getItemMeta();
|
||||
pirosuvegMeta.setDisplayName("§cItt még nincs játékmód!");
|
||||
@@ -168,18 +148,19 @@ public class DuelCommand implements CommandExecutor, TabCompleter {
|
||||
gui.setItem(8, kekuveg);
|
||||
gui.setItem(9, kekuveg);
|
||||
gui.setItem(10, vanilla);
|
||||
gui.setItem(11, uhc);
|
||||
gui.setItem(12, pot);
|
||||
gui.setItem(13, nethpot);
|
||||
gui.setItem(14, smp);
|
||||
gui.setItem(15, sword);
|
||||
gui.setItem(16, axe);
|
||||
gui.setItem(10, uhc);
|
||||
gui.setItem(11, pot);
|
||||
gui.setItem(12, nethpot);
|
||||
gui.setItem(13, smp);
|
||||
gui.setItem(14, sword);
|
||||
gui.setItem(15, axe);
|
||||
gui.setItem(16, mace);
|
||||
gui.setItem(17, kekuveg);
|
||||
gui.setItem(18, kekuveg);
|
||||
gui.setItem(19, mace);
|
||||
gui.setItem(20, cart);
|
||||
gui.setItem(21, diasmp);
|
||||
gui.setItem(22, shieldlessuhc);
|
||||
gui.setItem(19, diasmp);
|
||||
gui.setItem(20, pirosuveg);
|
||||
gui.setItem(21, pirosuveg);
|
||||
gui.setItem(22, pirosuveg);
|
||||
gui.setItem(23, pirosuveg);
|
||||
gui.setItem(24, pirosuveg);
|
||||
gui.setItem(25, pirosuveg);
|
||||
|
||||
@@ -33,61 +33,66 @@ public class EditKitCommand implements CommandExecutor, TabCompleter {
|
||||
if (sender instanceof Player player) {
|
||||
if (args.length > 0) {
|
||||
try {
|
||||
Database.QueryResult result = plugin.db.from("pvpcore_kits").eq("name", args[0]).execute().get();
|
||||
if (!result.isEmpty()) {
|
||||
Kits kitManager = new Kits(plugin);
|
||||
Inventory gui = Bukkit.createInventory(null, 27, "Kit Editor");
|
||||
|
||||
ItemStack saveKit = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
|
||||
ItemMeta saveMeta = saveKit.getItemMeta();
|
||||
|
||||
ItemStack infoItem = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
|
||||
ItemMeta infoMeta = infoItem.getItemMeta();
|
||||
infoMeta.setDisplayName("§fEdit Kit: " + args[0]);
|
||||
infoItem.setItemMeta(infoMeta);
|
||||
|
||||
ItemStack undoKit = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
ItemMeta undoMeta = undoKit.getItemMeta();
|
||||
saveMeta.setDisplayName("§aSave Kit");
|
||||
saveKit.setItemMeta(saveMeta);
|
||||
undoMeta.setDisplayName("§cUndo Changes");
|
||||
undoKit.setItemMeta(undoMeta);
|
||||
|
||||
gui.setItem(0, saveKit);
|
||||
gui.setItem(1, saveKit);
|
||||
gui.setItem(2, saveKit);
|
||||
gui.setItem(6, undoKit);
|
||||
gui.setItem(7, undoKit);
|
||||
gui.setItem(8, undoKit);
|
||||
gui.setItem(9, saveKit);
|
||||
gui.setItem(10, saveKit);
|
||||
gui.setItem(11, saveKit);
|
||||
gui.setItem(15, undoKit);
|
||||
gui.setItem(16, undoKit);
|
||||
gui.setItem(17, undoKit);
|
||||
gui.setItem(18, saveKit);
|
||||
gui.setItem(19, saveKit);
|
||||
gui.setItem(20, saveKit);
|
||||
gui.setItem(24, undoKit);
|
||||
gui.setItem(25, undoKit);
|
||||
gui.setItem(26, undoKit);
|
||||
gui.setItem(3, infoItem);
|
||||
gui.setItem(4, infoItem);
|
||||
gui.setItem(5, infoItem);
|
||||
gui.setItem(12, infoItem);
|
||||
gui.setItem(13, infoItem);
|
||||
gui.setItem(14, infoItem);
|
||||
gui.setItem(21, infoItem);
|
||||
gui.setItem(22, infoItem);
|
||||
gui.setItem(23, infoItem);
|
||||
Inventory inv = player.getInventory();
|
||||
inv.clear();
|
||||
|
||||
inv.setContents(kitManager.getKit(args[0], player, false));
|
||||
|
||||
player.openInventory(gui);
|
||||
Database.QueryResult isDueling = plugin.db.from("pvpcore_duels").eq("player", player.getUniqueId()).execute().get();
|
||||
if (isDueling.isEmpty()) {
|
||||
isDueling = plugin.db.from("pvpcore_duels").eq("enemy", player.getUniqueId()).execute().get();
|
||||
}
|
||||
if (isDueling.isEmpty()) {
|
||||
Database.QueryResult result = plugin.db.from("pvpcore_kits").eq("name", args[0]).execute().get();
|
||||
if (!result.isEmpty()) {
|
||||
Kits kitManager = new Kits(plugin);
|
||||
Inventory gui = Bukkit.createInventory(null, 27, "Kit Editor");
|
||||
|
||||
ItemStack saveKit = new ItemStack(Material.GREEN_STAINED_GLASS_PANE);
|
||||
ItemMeta saveMeta = saveKit.getItemMeta();
|
||||
|
||||
ItemStack infoItem = new ItemStack(Material.WHITE_STAINED_GLASS_PANE);
|
||||
ItemMeta infoMeta = infoItem.getItemMeta();
|
||||
infoMeta.setDisplayName("§fEdit Kit: " + args[0]);
|
||||
infoItem.setItemMeta(infoMeta);
|
||||
|
||||
ItemStack undoKit = new ItemStack(Material.RED_STAINED_GLASS_PANE);
|
||||
ItemMeta undoMeta = undoKit.getItemMeta();
|
||||
saveMeta.setDisplayName("§aSave Kit");
|
||||
saveKit.setItemMeta(saveMeta);
|
||||
undoMeta.setDisplayName("§cUndo Changes");
|
||||
undoKit.setItemMeta(undoMeta);
|
||||
|
||||
gui.setItem(0, saveKit);
|
||||
gui.setItem(1, saveKit);
|
||||
gui.setItem(2, saveKit);
|
||||
gui.setItem(6, undoKit);
|
||||
gui.setItem(7, undoKit);
|
||||
gui.setItem(8, undoKit);
|
||||
gui.setItem(9, saveKit);
|
||||
gui.setItem(10, saveKit);
|
||||
gui.setItem(11, saveKit);
|
||||
gui.setItem(15, undoKit);
|
||||
gui.setItem(16, undoKit);
|
||||
gui.setItem(17, undoKit);
|
||||
gui.setItem(18, saveKit);
|
||||
gui.setItem(19, saveKit);
|
||||
gui.setItem(20, saveKit);
|
||||
gui.setItem(24, undoKit);
|
||||
gui.setItem(25, undoKit);
|
||||
gui.setItem(26, undoKit);
|
||||
gui.setItem(3, infoItem);
|
||||
gui.setItem(4, infoItem);
|
||||
gui.setItem(5, infoItem);
|
||||
gui.setItem(12, infoItem);
|
||||
gui.setItem(13, infoItem);
|
||||
gui.setItem(14, infoItem);
|
||||
gui.setItem(21, infoItem);
|
||||
gui.setItem(22, infoItem);
|
||||
gui.setItem(23, infoItem);
|
||||
Inventory inv = player.getInventory();
|
||||
inv.clear();
|
||||
|
||||
inv.setContents(kitManager.getKit(args[0], player, false));
|
||||
|
||||
player.openInventory(gui);
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ExecutionException e) {
|
||||
|
||||
47
src/main/java/hu/jgj52/pvpcore/Commands/FfaCommand.java
Normal file
47
src/main/java/hu/jgj52/pvpcore/Commands/FfaCommand.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package hu.jgj52.pvpcore.Commands;
|
||||
|
||||
import hu.jgj52.pvpcore.Main;
|
||||
import hu.jgj52.pvpcore.Utils.Kits;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
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.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class FfaCommand implements CommandExecutor, TabCompleter {
|
||||
private final Main plugin;
|
||||
|
||||
public FfaCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String @NotNull [] args) {
|
||||
if (sender instanceof Player player) {
|
||||
Kits kits = new Kits(plugin);
|
||||
plugin.playersInFfa.add(player);
|
||||
player.teleport(new Location(Bukkit.getWorld("arenas"), 0.5, 0.5, plugin.ffaCoords + 0.5));
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
try {
|
||||
player.getInventory().setContents(kits.getKit("ffa", player, false));
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String @NotNull [] strings) {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package hu.jgj52.pvpcore.Commands;
|
||||
|
||||
import hu.jgj52.pvpcore.Main;
|
||||
import hu.jgj52.pvpcore.Utils.WorldReset;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -23,6 +24,7 @@ public class ResetArenasCommand implements CommandExecutor, TabCompleter {
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
|
||||
WorldReset worldReset = new WorldReset(plugin);
|
||||
worldReset.recreateArenaWorld();
|
||||
Bukkit.getScheduler().runTaskLater(plugin, worldReset::resetFfa, 40L);
|
||||
plugin.usedArenas = new ArrayList<>();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package hu.jgj52.pvpcore.Listeners;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import hu.jgj52.pvpcore.Main;
|
||||
import hu.jgj52.pvpcore.Utils.Database;
|
||||
import hu.jgj52.pvpcore.Utils.Kits;
|
||||
@@ -12,11 +13,9 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -46,177 +45,211 @@ public class DuelEndListener implements Listener {
|
||||
isEnemy = true;
|
||||
}
|
||||
|
||||
Map<String, Object> row = result.data.get(0);
|
||||
if (!result.isEmpty() && (Integer.parseInt(row.get("ft").toString()) - 1 == Integer.parseInt(row.get("player_points").toString()) || Integer.parseInt(row.get("ft").toString()) - 1 == Integer.parseInt(row.get("enemy_points").toString()))) {
|
||||
Player enemy = Bukkit.getPlayer(UUID.fromString(isEnemy ? row.get("player").toString() : row.get("enemy").toString()));
|
||||
player.getInventory().clear();
|
||||
enemy.getInventory().clear();
|
||||
e.setCancelled(true);
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
Location playerLoc = player.getLocation();
|
||||
if (!result.isEmpty()) {
|
||||
Map<String, Object> row = result.data.get(0);
|
||||
if (Integer.parseInt(row.get("ft").toString()) - 1 == Integer.parseInt(row.get("player_points").toString()) || Integer.parseInt(row.get("ft").toString()) - 1 == Integer.parseInt(row.get("enemy_points").toString())) {
|
||||
Player enemy = Bukkit.getPlayer(UUID.fromString(isEnemy ? row.get("player").toString() : row.get("enemy").toString()));
|
||||
player.getInventory().clear();
|
||||
enemy.getInventory().clear();
|
||||
e.setCancelled(true);
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
Location playerLoc = player.getLocation();
|
||||
|
||||
Title winnerTitle = Title.title(
|
||||
Component.text("§6🗡 §eMegnyerted a párbajt!"),
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ofMillis(500), Duration.ofSeconds(3), Duration.ofMillis(1000))
|
||||
);
|
||||
Title winnerTitle = Title.title(
|
||||
Component.text("§6🗡 §eMegnyerted a párbajt!"),
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ofMillis(500), Duration.ofSeconds(3), Duration.ofMillis(1000))
|
||||
);
|
||||
|
||||
Title loserTitle = Title.title(
|
||||
Component.text("§4🗡 §cElvesztetted a párbajt!"),
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ofMillis(500), Duration.ofSeconds(3), Duration.ofMillis(1000))
|
||||
);
|
||||
Title loserTitle = Title.title(
|
||||
Component.text("§4🗡 §cElvesztetted a párbajt!"),
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ofMillis(500), Duration.ofSeconds(3), Duration.ofMillis(1000))
|
||||
);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int delay = i * 10;
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
Firework firework = playerLoc.getWorld().spawn(playerLoc, Firework.class);
|
||||
FireworkMeta meta = firework.getFireworkMeta();
|
||||
|
||||
FireworkEffect effect = FireworkEffect.builder()
|
||||
.with(FireworkEffect.Type.BURST)
|
||||
.withColor(
|
||||
Color.fromRGB(2437522),
|
||||
Color.fromRGB(14602026),
|
||||
Color.fromRGB(6719955)
|
||||
)
|
||||
.build();
|
||||
|
||||
meta.addEffect(effect);
|
||||
meta.setPower((int) 0.5);
|
||||
firework.setFireworkMeta(meta);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
player.showTitle(loserTitle);
|
||||
enemy.showTitle(winnerTitle);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int delay = i * 10;
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
Firework firework = playerLoc.getWorld().spawn(playerLoc, Firework.class);
|
||||
FireworkMeta meta = firework.getFireworkMeta();
|
||||
|
||||
FireworkEffect effect = FireworkEffect.builder()
|
||||
.with(FireworkEffect.Type.BURST)
|
||||
.withColor(
|
||||
Color.fromRGB(2437522),
|
||||
Color.fromRGB(14602026),
|
||||
Color.fromRGB(6719955)
|
||||
)
|
||||
.build();
|
||||
|
||||
meta.addEffect(effect);
|
||||
meta.setPower((int) 0.5);
|
||||
firework.setFireworkMeta(meta);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
player.showTitle(loserTitle);
|
||||
enemy.showTitle(winnerTitle);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
try {
|
||||
plugin.tpToSpawn(player);
|
||||
plugin.tpToSpawn(enemy);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}, 60L);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("player", row.get("player"));
|
||||
data.put("enemy", row.get("enemy"));
|
||||
data.put("ft", row.get("ft"));
|
||||
data.put("kit", row.get("kit"));
|
||||
data.put("winner", enemy.getUniqueId());
|
||||
data.put("loser", player.getUniqueId());
|
||||
data.put("player_points", row.get("player_points"));
|
||||
data.put("enemy_points", row.get("enemy_points"));
|
||||
data.put("started", row.get("started"));
|
||||
data.put("ended", System.currentTimeMillis());
|
||||
plugin.db.from("pvpcore_duel_logs").insert(data);
|
||||
plugin.db.from("pvpcore_duels").eq(isEnemy ? "enemy" : "player", player.getUniqueId()).eq(isEnemy ? "player" : "enemy", enemy.getUniqueId()).delete();
|
||||
} else if (!result.isEmpty() && Integer.parseInt(row.get("ft").toString()) - 1 != Integer.parseInt(row.get("player_points").toString()) && Integer.parseInt(row.get("ft").toString()) - 1 != Integer.parseInt(row.get("enemy_points").toString())) {
|
||||
Player enemy = Bukkit.getPlayer(UUID.fromString(isEnemy ? row.get("player").toString() : row.get("enemy").toString()));
|
||||
Kits kitManager = new Kits(plugin);
|
||||
SchematicManager schematic = new SchematicManager(plugin);
|
||||
|
||||
String gamemode = row.get("kit").toString();
|
||||
|
||||
Database.QueryResult kitResult = null;
|
||||
try {
|
||||
kitResult = plugin.db.from("pvpcore_kits")
|
||||
.eq("name", gamemode)
|
||||
.execute()
|
||||
.get();
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
Map<String, Object> kitRow = kitResult.data.get(0);
|
||||
|
||||
player.getInventory().clear();
|
||||
enemy.getInventory().clear();
|
||||
e.setCancelled(true);
|
||||
World world = Bukkit.getWorld("arenas");
|
||||
boolean survival = Boolean.parseBoolean(kitRow.get("survival").toString());
|
||||
String arena = kitRow.get("arena").toString();
|
||||
int x = Integer.parseInt(kitRow.get("id").toString()) * 1000;
|
||||
int y = 0;
|
||||
int z;
|
||||
|
||||
if (plugin.usedArenas.isEmpty()) {
|
||||
z = 0;
|
||||
} else {
|
||||
z = min(plugin.usedArenas) - 1000;
|
||||
}
|
||||
|
||||
plugin.usedArenas.add(z);
|
||||
|
||||
schematic.placeSchematic(world, x, y, z, arena, true);
|
||||
Location playerLoc = new Location(world, x + 20.5, y, z + 0.5, 90, 0);
|
||||
Location enemyLoc = new Location(world, x - 20.5, y, 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);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {player.teleport(playerLoc);enemy.teleport(enemyLoc);}, 2L);
|
||||
|
||||
try {
|
||||
player.getInventory().setContents(kitManager.getKit(gamemode, player, false));
|
||||
enemy.getInventory().setContents(kitManager.getKit(gamemode, enemy, false));
|
||||
} catch (ExecutionException | InterruptedException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
player.setHealth(20D);
|
||||
enemy.setHealth(20D);
|
||||
player.setFoodLevel(20);
|
||||
enemy.setFoodLevel(20);
|
||||
player.setSaturation(5);
|
||||
enemy.setSaturation(5);
|
||||
player.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
enemy.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
|
||||
Map<String, Object> duelData = new HashMap<>();
|
||||
duelData.put("player", row.get("player"));
|
||||
duelData.put("enemy", row.get("enemy"));
|
||||
duelData.put("ft", row.get("ft"));
|
||||
duelData.put("kit", row.get("kit"));
|
||||
duelData.put(isEnemy ? "player_points" : "enemy_points", Integer.parseInt(row.get(isEnemy ? "player_points" : "enemy_points").toString()) + 1);
|
||||
duelData.put("started", row.get("started"));
|
||||
|
||||
plugin.db.from("pvpcore_duels").update(duelData);
|
||||
|
||||
new BukkitRunnable() {
|
||||
int countdown = 3;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (countdown > 0) {
|
||||
Component titleText = Component.text(String.valueOf(countdown), NamedTextColor.AQUA);
|
||||
Title title = Title.title(
|
||||
titleText,
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ZERO, Duration.ofSeconds(1), Duration.ZERO)
|
||||
);
|
||||
player.showTitle(title);
|
||||
enemy.showTitle(title);
|
||||
countdown--;
|
||||
} else {
|
||||
Title startTitle = Title.title(
|
||||
Component.text("§eA párbaj megkezdődött!"),
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ZERO, Duration.ofSeconds(2), Duration.ofSeconds(1))
|
||||
);
|
||||
player.showTitle(startTitle);
|
||||
enemy.showTitle(startTitle);
|
||||
cancel();
|
||||
try {
|
||||
plugin.tpToSpawn(player);
|
||||
plugin.tpToSpawn(enemy);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}, 60L);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("player", row.get("player"));
|
||||
data.put("enemy", row.get("enemy"));
|
||||
data.put("ft", row.get("ft"));
|
||||
data.put("kit", row.get("kit"));
|
||||
data.put("winner", enemy.getUniqueId());
|
||||
data.put("loser", player.getUniqueId());
|
||||
data.put("player_points", row.get("player_points"));
|
||||
data.put("enemy_points", row.get("enemy_points"));
|
||||
data.put(isEnemy ? "player_points" : "enemy_points", Integer.parseInt(row.get(isEnemy ? "player_points" : "enemy_points").toString()) + 1);
|
||||
data.put("started", row.get("started"));
|
||||
data.put("ended", System.currentTimeMillis());
|
||||
plugin.db.from("pvpcore_duel_logs").insert(data);
|
||||
plugin.db.from("pvpcore_duels").eq(isEnemy ? "enemy" : "player", player.getUniqueId()).eq(isEnemy ? "player" : "enemy", enemy.getUniqueId()).delete();
|
||||
} else if (Integer.parseInt(row.get("ft").toString()) - 1 != Integer.parseInt(row.get("player_points").toString()) && Integer.parseInt(row.get("ft").toString()) - 1 != Integer.parseInt(row.get("enemy_points").toString())) {
|
||||
Player enemy = Bukkit.getPlayer(UUID.fromString(isEnemy ? row.get("player").toString() : row.get("enemy").toString()));
|
||||
Kits kitManager = new Kits(plugin);
|
||||
SchematicManager schematic = new SchematicManager(plugin);
|
||||
|
||||
String gamemode = row.get("kit").toString();
|
||||
|
||||
Database.QueryResult kitResult;
|
||||
try {
|
||||
kitResult = plugin.db.from("pvpcore_kits")
|
||||
.eq("name", gamemode)
|
||||
.execute()
|
||||
.get();
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 20L);
|
||||
|
||||
Map<String, Object> kitRow = kitResult.data.get(0);
|
||||
Database.QueryResult arenaResult;
|
||||
try {
|
||||
arenaResult = plugin.db.from("pvpcore_arenas").eq("id", Integer.parseInt(kitRow.get("arena").toString())).execute().get();
|
||||
} catch (InterruptedException | ExecutionException err) {
|
||||
throw new RuntimeException(err);
|
||||
}
|
||||
|
||||
Map<String, Object> arenaRow = arenaResult.data.get(0);
|
||||
|
||||
player.getInventory().clear();
|
||||
enemy.getInventory().clear();
|
||||
e.setCancelled(true);
|
||||
World world = Bukkit.getWorld("arenas");
|
||||
boolean survival = Boolean.parseBoolean(kitRow.get("survival").toString());
|
||||
String arena = arenaRow.get("name").toString();
|
||||
int x = Integer.parseInt(kitRow.get("id").toString()) * 1000;
|
||||
int y = 0;
|
||||
int z;
|
||||
|
||||
if (plugin.usedArenas.isEmpty()) {
|
||||
z = 0;
|
||||
} else {
|
||||
z = min(plugin.usedArenas) - 1000;
|
||||
}
|
||||
|
||||
plugin.usedArenas.add(z);
|
||||
|
||||
schematic.placeSchematic(world, x, y, z, arena, true);
|
||||
|
||||
com.google.gson.Gson gson = new com.google.gson.Gson();
|
||||
Type type = new TypeToken<List<List<List<Integer>>>>() {
|
||||
}.getType();
|
||||
List<List<List<Integer>>> regions = gson.fromJson(arenaRow.get("regions").toString(), type);
|
||||
|
||||
for (List<List<Integer>> region : regions) {
|
||||
List<Integer> pos1 = region.get(0);
|
||||
List<Integer> pos2 = region.get(1);
|
||||
|
||||
int x1 = pos1.get(0), y1 = pos1.get(1), z1 = pos1.get(2);
|
||||
int x2 = pos2.get(0), y2 = pos2.get(1), z2 = pos2.get(2);
|
||||
Location loc1 = new Location(world, x + x1, y + y1, z + z1);
|
||||
Location loc2 = new Location(world, x + x2, y + y2, z + z2);
|
||||
|
||||
schematic.createRegion(world, UUID.randomUUID().toString(), loc1, loc2);
|
||||
}
|
||||
|
||||
Location playerLoc = new Location(world, x + 20.5, y, z + 0.5, 90, 0);
|
||||
Location enemyLoc = new Location(world, x - 20.5, y, 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);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||
player.teleport(playerLoc);
|
||||
enemy.teleport(enemyLoc);
|
||||
}, 2L);
|
||||
|
||||
try {
|
||||
player.getInventory().setContents(kitManager.getKit(gamemode, player, false));
|
||||
enemy.getInventory().setContents(kitManager.getKit(gamemode, enemy, false));
|
||||
} catch (ExecutionException | InterruptedException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
player.setHealth(20D);
|
||||
enemy.setHealth(20D);
|
||||
player.setFoodLevel(20);
|
||||
enemy.setFoodLevel(20);
|
||||
player.setSaturation(5);
|
||||
enemy.setSaturation(5);
|
||||
player.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
enemy.setGameMode(survival ? GameMode.SURVIVAL : GameMode.ADVENTURE);
|
||||
|
||||
Map<String, Object> duelData = new HashMap<>();
|
||||
duelData.put("player", row.get("player"));
|
||||
duelData.put("enemy", row.get("enemy"));
|
||||
duelData.put("ft", row.get("ft"));
|
||||
duelData.put("kit", row.get("kit"));
|
||||
duelData.put(isEnemy ? "player_points" : "enemy_points", Integer.parseInt(row.get(isEnemy ? "player_points" : "enemy_points").toString()) + 1);
|
||||
duelData.put("started", row.get("started"));
|
||||
|
||||
plugin.db.from("pvpcore_duels").update(duelData);
|
||||
|
||||
new BukkitRunnable() {
|
||||
int countdown = 3;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (countdown > 0) {
|
||||
Component titleText = Component.text(String.valueOf(countdown), NamedTextColor.AQUA);
|
||||
Title title = Title.title(
|
||||
titleText,
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ZERO, Duration.ofSeconds(1), Duration.ZERO)
|
||||
);
|
||||
player.showTitle(title);
|
||||
enemy.showTitle(title);
|
||||
countdown--;
|
||||
} else {
|
||||
Title startTitle = Title.title(
|
||||
Component.text("§eA párbaj megkezdődött!"),
|
||||
Component.empty(),
|
||||
Title.Times.times(Duration.ZERO, Duration.ofSeconds(2), Duration.ofSeconds(1))
|
||||
);
|
||||
player.showTitle(startTitle);
|
||||
enemy.showTitle(startTitle);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 20L);
|
||||
}
|
||||
} else if (plugin.playersInFfa.contains(player)) {
|
||||
plugin.playersInFfa.remove(player);
|
||||
} else {
|
||||
e.setCancelled(true);
|
||||
plugin.tpToSpawn(player);
|
||||
|
||||
@@ -47,55 +47,92 @@ public class KitListener implements Listener {
|
||||
String gamemode = event.getClickedInventory().getItem(13).getItemMeta().getDisplayName().split(" ")[2];
|
||||
|
||||
ItemStack[] kit = kitsUtil.getKit(gamemode, player, true);
|
||||
Map<String, Integer> kitTotals = new HashMap<>();
|
||||
for (ItemStack kitItem : kit) {
|
||||
if (kitItem == null) continue;
|
||||
String key = kitItem.getType().toString() + kitItem.getItemMeta().toString();
|
||||
kitTotals.put(key, kitTotals.getOrDefault(key, 0) + kitItem.getAmount());
|
||||
}
|
||||
|
||||
String base64Inv = Kits.itemStackArrayToBase64(player.getInventory().getContents());
|
||||
Map<String, Integer> invTotals = new HashMap<>();
|
||||
for (ItemStack invItem : player.getInventory().getContents()) {
|
||||
if (invItem == null) continue;
|
||||
String key = invItem.getType().toString() + invItem.getItemMeta().toString();
|
||||
invTotals.put(key, invTotals.getOrDefault(key, 0) + invItem.getAmount());
|
||||
}
|
||||
|
||||
Database.QueryResult plResult = plugin.db.from("pvpcore_players")
|
||||
.eq("uuid", player.getUniqueId())
|
||||
.execute()
|
||||
.get();
|
||||
boolean valid = true;
|
||||
for (Map.Entry<String, Integer> entry : invTotals.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
int invAmount = entry.getValue();
|
||||
int kitAmount = kitTotals.getOrDefault(key, 0);
|
||||
if (invAmount != kitAmount) {
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> playerKits;
|
||||
if (!plResult.isEmpty()) {
|
||||
Map<String, Object> playerRow = plResult.data.get(0);
|
||||
Object kitsObj = playerRow.get("kits");
|
||||
if (kitsObj != null) {
|
||||
String playerKitsStr = kitsObj instanceof PGobject pg ? pg.getValue() : kitsObj.toString();
|
||||
java.lang.reflect.Type type = new com.google.gson.reflect.TypeToken<Map<String, String>>() {}.getType();
|
||||
playerKits = new com.google.gson.Gson().fromJson(playerKitsStr, type);
|
||||
for (String key : invTotals.keySet()) {
|
||||
if (!kitTotals.containsKey(key)) {
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (valid) {
|
||||
String base64Inv = Kits.itemStackArrayToBase64(player.getInventory().getContents());
|
||||
|
||||
Database.QueryResult plResult = plugin.db.from("pvpcore_players")
|
||||
.eq("uuid", player.getUniqueId())
|
||||
.execute()
|
||||
.get();
|
||||
|
||||
Map<String, String> playerKits;
|
||||
if (!plResult.isEmpty()) {
|
||||
Map<String, Object> playerRow = plResult.data.get(0);
|
||||
Object kitsObj = playerRow.get("kits");
|
||||
if (kitsObj != null) {
|
||||
String playerKitsStr = kitsObj instanceof PGobject pg ? pg.getValue() : kitsObj.toString();
|
||||
java.lang.reflect.Type type = new com.google.gson.reflect.TypeToken<Map<String, String>>() {
|
||||
}.getType();
|
||||
playerKits = new com.google.gson.Gson().fromJson(playerKitsStr, type);
|
||||
} else {
|
||||
playerKits = new HashMap<>();
|
||||
}
|
||||
} else {
|
||||
playerKits = new HashMap<>();
|
||||
}
|
||||
|
||||
Database.QueryResult result = plugin.db.from("pvpcore_kits")
|
||||
.eq("name", gamemode)
|
||||
.execute()
|
||||
.get();
|
||||
|
||||
Map<String, Object> kitRow = result.data.get(0);
|
||||
|
||||
playerKits.put(kitRow.get("id").toString(), base64Inv);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
PGobject jsonObj = new PGobject();
|
||||
jsonObj.setType("json");
|
||||
jsonObj.setValue(new com.google.gson.Gson().toJson(playerKits));
|
||||
data.put("kits", jsonObj);
|
||||
|
||||
plugin.db.from("pvpcore_players")
|
||||
.eq("uuid", player.getUniqueId())
|
||||
.update(data)
|
||||
.thenAccept(r -> player.sendMessage("§aA kit el lett mentve."))
|
||||
.exceptionally(ex -> {
|
||||
ex.printStackTrace();
|
||||
player.sendMessage("§cHiba történt a kit mentése közben.");
|
||||
return null;
|
||||
});
|
||||
|
||||
player.closeInventory();
|
||||
} else {
|
||||
playerKits = new HashMap<>();
|
||||
player.closeInventory();
|
||||
player.sendMessage("§cA kited nem került mentésre.");
|
||||
}
|
||||
|
||||
Database.QueryResult result = plugin.db.from("pvpcore_kits")
|
||||
.eq("name", gamemode)
|
||||
.execute()
|
||||
.get();
|
||||
|
||||
Map<String, Object> kitRow = result.data.get(0);
|
||||
|
||||
playerKits.put(kitRow.get("id").toString(), base64Inv);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
PGobject jsonObj = new PGobject();
|
||||
jsonObj.setType("json");
|
||||
jsonObj.setValue(new com.google.gson.Gson().toJson(playerKits));
|
||||
data.put("kits", jsonObj);
|
||||
|
||||
plugin.db.from("pvpcore_players")
|
||||
.eq("uuid", player.getUniqueId())
|
||||
.update(data)
|
||||
.thenAccept(r -> player.sendMessage("§aA kit el lett mentve."))
|
||||
.exceptionally(ex -> {
|
||||
ex.printStackTrace();
|
||||
player.sendMessage("§cHiba történt a kit mentése közben.");
|
||||
return null;
|
||||
});
|
||||
|
||||
player.closeInventory();
|
||||
} else if (cancelSlot) {
|
||||
player.closeInventory();
|
||||
player.sendMessage("§cA kited nem került mentésre.");
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package hu.jgj52.pvpcore.Listeners;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
import hu.jgj52.pvpcore.Main;
|
||||
import hu.jgj52.pvpcore.Utils.Database;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -11,6 +18,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
@@ -49,6 +57,7 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent e) throws ExecutionException, InterruptedException {
|
||||
Player player = e.getPlayer();
|
||||
plugin.playersInFfa.remove(player);
|
||||
boolean isEnemy = false;
|
||||
Database.QueryResult result = plugin.db.from("pvpcore_duels").eq("player", player.getUniqueId()).execute().get();
|
||||
if (result.isEmpty()) {
|
||||
@@ -115,4 +124,21 @@ public class PlayerListener implements Listener {
|
||||
plugin.db.from("pvpcore_duels").eq(isEnemy ? "enemy" : "player", player.getUniqueId()).eq(isEnemy ? "player" : "enemy", enemy.getUniqueId()).delete();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTeleport(PlayerTeleportEvent e) {
|
||||
Location from = e.getFrom();
|
||||
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionQuery query = container.createQuery();
|
||||
ApplicableRegionSet regions = query.getApplicableRegions(BukkitAdapter.adapt(from));
|
||||
|
||||
StateFlag.State exitFlag = regions.queryValue(null, Flags.EXIT);
|
||||
if (exitFlag != StateFlag.State.DENY) return;
|
||||
|
||||
if (e.getCause() == PlayerTeleportEvent.TeleportCause.ENDER_PEARL) {
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().sendMessage("§c§lHey! §r§7You are not permitted to leave this area.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,29 @@
|
||||
package hu.jgj52.pvpcore;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import hu.jgj52.pvpcore.Commands.*;
|
||||
import hu.jgj52.pvpcore.Listeners.*;
|
||||
import hu.jgj52.pvpcore.Utils.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static java.util.Collections.min;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
public int ffaCoords;
|
||||
|
||||
public Database db = new Database(getConfig().getString("database.host"), getConfig().getInt("database.port"), getConfig().getString("database.database"), getConfig().getString("database.user"), getConfig().getString("database.password"));
|
||||
|
||||
public void tpToSpawn(Player player) {
|
||||
@@ -26,6 +32,7 @@ public final class Main extends JavaPlugin {
|
||||
player.removePotionEffect(potionEffect.getType());
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20, 1), true);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200, 1), true);
|
||||
player.setHealth(20D);
|
||||
player.setFoodLevel(20);
|
||||
player.setSaturation(5);
|
||||
@@ -53,6 +60,7 @@ public final class Main extends JavaPlugin {
|
||||
getCommand("leave").setExecutor(new LeaveCommand(this));
|
||||
getCommand("createkit").setExecutor(new CreateKitCommand(this));
|
||||
getCommand("connect").setExecutor(new ConnectCommand(this));
|
||||
getCommand("ffa").setExecutor(new FfaCommand(this));
|
||||
|
||||
getServer().getPluginManager().registerEvents(new DuelRequestListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new KitListener(this), this);
|
||||
@@ -62,7 +70,6 @@ public final class Main extends JavaPlugin {
|
||||
|
||||
WorldReset worldReset = new WorldReset(this);
|
||||
worldReset.recreateArenaWorld();
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -97,6 +104,15 @@ public final class Main extends JavaPlugin {
|
||||
}
|
||||
}.runTaskTimer(this, 100L, 100L);
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
worldReset.resetFfa();
|
||||
}
|
||||
}.runTaskTimer(this, 12000L, 12000L);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(this, worldReset::resetFfa, 40L);
|
||||
|
||||
db.from("pvpcore_duels").delete();
|
||||
db.from("pvpcore_duel_requests").delete();
|
||||
db.from("pvpcore_connect").delete();
|
||||
@@ -108,4 +124,5 @@ public final class Main extends JavaPlugin {
|
||||
}
|
||||
|
||||
public List<Integer> usedArenas = new ArrayList<>();
|
||||
public List<Player> playersInFfa = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -10,9 +10,15 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.managers.storage.StorageException;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import com.sk89q.worldguard.protection.regions.RegionContainer;
|
||||
import hu.jgj52.pvpcore.Main;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@@ -70,28 +76,50 @@ public class SchematicManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeSchematic(World world, Location loc1, Location loc2) {
|
||||
public boolean createRegion(World world, String regionName, Location loc1, Location loc2) {
|
||||
try {
|
||||
com.sk89q.worldedit.world.World weWorld = BukkitAdapter.adapt(world);
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager regions = container.get(BukkitAdapter.adapt(world));
|
||||
|
||||
int minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
|
||||
int maxX = Math.max(loc1.getBlockX(), loc2.getBlockX());
|
||||
int minY = Math.min(loc1.getBlockY(), loc2.getBlockY());
|
||||
int maxY = Math.max(loc1.getBlockY(), loc2.getBlockY());
|
||||
int minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
|
||||
int maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ());
|
||||
|
||||
BlockVector3 min = BlockVector3.at(minX, minY, minZ);
|
||||
BlockVector3 max = BlockVector3.at(maxX, maxY, maxZ);
|
||||
CuboidRegion region = new CuboidRegion(weWorld, min, max);
|
||||
|
||||
try (EditSession editSession = WorldEdit.getInstance().newEditSession(weWorld)) {
|
||||
editSession.setBlocks(region, BlockTypes.AIR.getDefaultState());
|
||||
editSession.flushSession();
|
||||
return true;
|
||||
if (regions == null) {
|
||||
plugin.getLogger().warning("No RegionManager found for world: " + world.getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockVector3 min = BlockVector3.at(
|
||||
Math.min(loc1.getBlockX(), loc2.getBlockX()),
|
||||
Math.min(loc1.getBlockY(), loc2.getBlockY()),
|
||||
Math.min(loc1.getBlockZ(), loc2.getBlockZ())
|
||||
);
|
||||
|
||||
BlockVector3 max = BlockVector3.at(
|
||||
Math.max(loc1.getBlockX(), loc2.getBlockX()),
|
||||
Math.max(loc1.getBlockY(), loc2.getBlockY()),
|
||||
Math.max(loc1.getBlockZ(), loc2.getBlockZ())
|
||||
);
|
||||
|
||||
ProtectedRegion region = new ProtectedCuboidRegion(regionName, min, max);
|
||||
region.setFlag(Flags.BUILD, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.BLOCK_PLACE, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.BLOCK_BREAK, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.TNT, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.OTHER_EXPLOSION, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.RESPAWN_ANCHORS, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.CREEPER_EXPLOSION, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.FIRE_SPREAD, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.LAVA_FIRE, StateFlag.State.DENY);
|
||||
region.setFlag(Flags.EXIT, StateFlag.State.DENY);
|
||||
|
||||
regions.addRegion(region);
|
||||
|
||||
regions.save();
|
||||
return true;
|
||||
} catch (StorageException e) {
|
||||
plugin.getLogger().severe("Failed to save WorldGuard regions: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
plugin.getLogger().severe("Error removing schematic: " + e.getMessage());
|
||||
plugin.getLogger().severe("Error creating WorldGuard region: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,29 @@
|
||||
package hu.jgj52.pvpcore.Utils;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import hu.jgj52.pvpcore.Main;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static java.util.Collections.min;
|
||||
|
||||
public class WorldReset {
|
||||
private Plugin plugin;
|
||||
private Main plugin;
|
||||
|
||||
public WorldReset(Plugin plugin) {
|
||||
public WorldReset(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public final String[] metadatas = {"DuelingWith", "ArenaLoc", "Frozen", "DuelRequest", "DueledBy", "DueledWithGamemode", "IsSpectating"};
|
||||
|
||||
public boolean recreateArenaWorld() {
|
||||
String worldName = "arenas";
|
||||
|
||||
@@ -39,29 +46,18 @@ public class WorldReset {
|
||||
private boolean removeArenaWorld(String worldName) {
|
||||
try {
|
||||
World world = Bukkit.getWorld(worldName);
|
||||
RegionManager manager = WorldGuard.getInstance()
|
||||
.getPlatform().getRegionContainer()
|
||||
.get(BukkitAdapter.adapt(world));
|
||||
|
||||
for (String regionId : manager.getRegions().keySet()) {
|
||||
manager.removeRegion(regionId);
|
||||
}
|
||||
|
||||
if (world != null) {
|
||||
|
||||
world.getPlayers().forEach(player -> {
|
||||
Location spawn = new Location(Bukkit.getWorld("world"), 0, 3, 0, 0, 0);
|
||||
for (PotionEffect potionEffect : player.getActivePotionEffects()) {
|
||||
player.removePotionEffect(potionEffect.getType());
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 20, 1), true);
|
||||
player.setHealth(20D);
|
||||
player.setFoodLevel(20);
|
||||
player.setSaturation(5);
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
player.teleport(spawn);
|
||||
for (String key : metadatas) {
|
||||
for (MetadataValue value : player.getMetadata(key)) {
|
||||
if (value.getOwningPlugin() == plugin) {
|
||||
player.removeMetadata(key, plugin);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
player.sendMessage("§cszia resetel a map szoval tunes");
|
||||
plugin.tpToSpawn(player);
|
||||
});
|
||||
|
||||
boolean unloaded = Bukkit.unloadWorld(world, false);
|
||||
@@ -103,6 +99,7 @@ public class WorldReset {
|
||||
world.setStorm(false);
|
||||
world.setThundering(false);
|
||||
world.setGameRule(GameRule.DO_WEATHER_CYCLE, false);
|
||||
world.setGameRule(GameRule.DO_IMMEDIATE_RESPAWN, true);
|
||||
return true;
|
||||
} else {
|
||||
plugin.getLogger().severe("Failed to create arena world!");
|
||||
@@ -131,4 +128,53 @@ public class WorldReset {
|
||||
}
|
||||
return directory.delete();
|
||||
}
|
||||
|
||||
public void resetFfa() {
|
||||
int nowZ = plugin.ffaCoords;
|
||||
if (plugin.usedArenas.isEmpty()) {
|
||||
plugin.ffaCoords = 0;
|
||||
} else {
|
||||
plugin.ffaCoords = min(plugin.usedArenas) - 1000;
|
||||
}
|
||||
|
||||
plugin.usedArenas.add(plugin.ffaCoords);
|
||||
|
||||
Database.QueryResult arenaResult;
|
||||
try {
|
||||
arenaResult = plugin.db.from("pvpcore_arenas").eq("id", Integer.parseInt("2")).execute().get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
SchematicManager schematic = new SchematicManager(plugin);
|
||||
|
||||
Map<String, Object> arenaRow = arenaResult.data.get(0);
|
||||
|
||||
World world = Bukkit.getWorld("arenas");
|
||||
|
||||
schematic.placeSchematic(world, 0, 0, plugin.ffaCoords, arenaRow.get("name").toString(), true);
|
||||
|
||||
com.google.gson.Gson gson = new com.google.gson.Gson();
|
||||
Type type = new TypeToken<List<List<List<Integer>>>>() {
|
||||
}.getType();
|
||||
List<List<List<Integer>>> regions = gson.fromJson(arenaRow.get("regions").toString(), type);
|
||||
|
||||
for (List<List<Integer>> region : regions) {
|
||||
List<Integer> pos1 = region.get(0);
|
||||
List<Integer> pos2 = region.get(1);
|
||||
|
||||
int x1 = pos1.get(0), y1 = pos1.get(1), z1 = pos1.get(2);
|
||||
int x2 = pos2.get(0), y2 = pos2.get(1), z2 = pos2.get(2);
|
||||
|
||||
Location loc1 = new Location(world, x1, y1, plugin.ffaCoords + z1);
|
||||
Location loc2 = new Location(world, x2, y2, plugin.ffaCoords + z2);
|
||||
|
||||
schematic.createRegion(world, UUID.randomUUID().toString(), loc1, loc2);
|
||||
}
|
||||
|
||||
for (Player player : plugin.playersInFfa) {
|
||||
Location newLoc = new Location(world, player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ() + (plugin.ffaCoords - nowZ));
|
||||
player.teleport(newLoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,3 +18,4 @@ commands:
|
||||
createkit:
|
||||
permission: pvpcore.createkit
|
||||
connect:
|
||||
ffa:
|
||||
Reference in New Issue
Block a user