From 471e1b24450d3f6325a841b6217c755db35e81a9 Mon Sep 17 00:00:00 2001 From: andre Date: Sat, 9 Sep 2023 17:28:22 +0200 Subject: [PATCH] 09-09-Sat 05:28 --- .../me/ghostdevelopment/kore/Functions.java | 36 ++++++++++++++++--- .../kore/commands/commands/CommandKore.java | 5 +-- .../commands/admin/CommandTeleport.java | 3 +- .../admin/gamemodes/CommandGamemode.java | 8 ++--- .../commands/player/CommandSpawn.java | 19 ++++++---- src/main/resources/lang/al.yml | 2 +- src/main/resources/lang/cz.yml | 2 +- src/main/resources/lang/de.yml | 2 +- src/main/resources/lang/en.yml | 2 +- src/main/resources/lang/es.yml | 2 +- src/main/resources/lang/fr.yml | 2 +- src/main/resources/lang/it.yml | 2 +- src/main/resources/lang/ru.yml | 2 +- src/main/resources/plugin.yml | 3 ++ 14 files changed, 64 insertions(+), 26 deletions(-) diff --git a/src/main/java/me/ghostdevelopment/kore/Functions.java b/src/main/java/me/ghostdevelopment/kore/Functions.java index 6f2df0e..de5279b 100644 --- a/src/main/java/me/ghostdevelopment/kore/Functions.java +++ b/src/main/java/me/ghostdevelopment/kore/Functions.java @@ -3,12 +3,11 @@ import me.ghostdevelopment.kore.files.LangFile; import me.ghostdevelopment.kore.files.SettingsFile; import me.ghostdevelopment.kore.files.StorageFile; -import net.minecraft.server.v1_8_R3.World; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Entity; import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import java.util.ArrayList; import java.util.List; @@ -30,6 +29,10 @@ public static void reloadFiles(){ } + public static void updatePlugin(){ + // SOON + } + // ///////////////////////////////////////////////////////////////////////////////////////////////////// public static void setSpawnLoc(Location loc){ @@ -177,7 +180,32 @@ public static Boolean checkHome(Player player){ public static void setSpeed(Player player, String type, Float speed){ if(type.equals("walk")){ - player.setWalkSpeed(speed / 10.0f); + + int speedInt = 0; + + if (speed >= 0.1 && speed <= 1.0) { + speedInt = 1; + } else if (speed > 1.1 && speed <= 2.0) { + speedInt = 2; + } else if (speed > 2.1 && speed <= 3.0) { + speedInt = 3; + } else if (speed > 3.1 && speed <= 4.0) { + speedInt = 4; + } else if (speed > 4.1 && speed <= 5.0) { + speedInt = 5; + } else if (speed > 5.1 && speed <= 6.0) { + speedInt = 6; + } else if (speed > 6.1 && speed <= 7.0) { + speedInt = 7; + } else if (speed > 7.1 && speed <= 8.0) { + speedInt = 8; + } else if (speed > 8.1 && speed <= 9.0) { + speedInt = 9; + } else if (speed > 9.1 && speed <= 10.0) { + speedInt = 10; + } + + player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, speedInt)); } else if (type.equals("fly") || type.equals("flight")) { player.setFlySpeed(speed / 10.0f); } diff --git a/src/main/java/me/ghostdevelopment/kore/commands/commands/CommandKore.java b/src/main/java/me/ghostdevelopment/kore/commands/commands/CommandKore.java index fa6f8d9..a402935 100644 --- a/src/main/java/me/ghostdevelopment/kore/commands/commands/CommandKore.java +++ b/src/main/java/me/ghostdevelopment/kore/commands/commands/CommandKore.java @@ -25,7 +25,7 @@ public void execute(CommandSender sender, String[] args) { Player player = (Player) sender; if (args.length == 0) { - player.sendMessage(Color.Color("\n&aThis server is running Kore.")); + player.sendMessage(Color.Color("\n&aThis server is running Kore v$ver\n".replace("$ver", Kore.getInstance().getDescription().getVersion()))); } else if (args.length == 1) { if (args[0].equalsIgnoreCase("info")) { player.sendMessage(Color.Color( @@ -80,7 +80,7 @@ public void execute(CommandSender sender, String[] args) { "&7/spawnmob &c &1[num]\n" )); }else{ - player.sendMessage(Color.Color("\n&aThis server is running Kore.")); + player.sendMessage(Color.Color("\n&aThis server is running Kore v$ver\n".replace("$ver", Kore.getInstance().getDescription().getVersion()))); } }else if (args.length==2) { @@ -199,6 +199,7 @@ public List onTabComplete(CommandSender sender, Command command, String completions.add("help"); completions.add("lang"); completions.add("language"); + completions.add("update (SOON)"); } else if (args.length == 2 && (args[0].equalsIgnoreCase("lang") || args[0].equalsIgnoreCase("language"))) { completions.addAll(LangFile.getAvailableLanguages()); } diff --git a/src/main/java/me/ghostdevelopment/kore/commands/commands/admin/CommandTeleport.java b/src/main/java/me/ghostdevelopment/kore/commands/commands/admin/CommandTeleport.java index cdbce5c..61deb7e 100644 --- a/src/main/java/me/ghostdevelopment/kore/commands/commands/admin/CommandTeleport.java +++ b/src/main/java/me/ghostdevelopment/kore/commands/commands/admin/CommandTeleport.java @@ -35,7 +35,6 @@ public void execute(CommandSender sender, String[] args) { if(args.length!=1||args.length!=2||args.length!=3||args.length!=4){ try{ - // tp if(args.length==1){ Player target = Bukkit.getPlayer(args[0]); @@ -154,7 +153,7 @@ public List onTabComplete(CommandSender sender, Command command, String } } } else if (args.length==2) { - String partialName = args[0].toLowerCase(); + String partialName = args[1].toLowerCase(); for(Player player: Bukkit.getOnlinePlayers()){ if (player.getName().startsWith(partialName)){ completions.add(player.getName()); diff --git a/src/main/java/me/ghostdevelopment/kore/commands/commands/admin/gamemodes/CommandGamemode.java b/src/main/java/me/ghostdevelopment/kore/commands/commands/admin/gamemodes/CommandGamemode.java index fbc61e5..cbdd54b 100644 --- a/src/main/java/me/ghostdevelopment/kore/commands/commands/admin/gamemodes/CommandGamemode.java +++ b/src/main/java/me/ghostdevelopment/kore/commands/commands/admin/gamemodes/CommandGamemode.java @@ -148,10 +148,10 @@ public void execute(CommandSender sender, String[] args) { } } }else{ - String type = args[0]; - Player target = Bukkit.getPlayer(args[1]); - try{ + String type = args[0]; + Player target = Bukkit.getPlayer(args[1]); + if(type.equalsIgnoreCase("0")){ target.setGameMode(GameMode.SURVIVAL); sender.sendMessage(Color.Color(LangFile.getFile().getString("gamemode.changed") @@ -222,7 +222,7 @@ public List onTabComplete(CommandSender sender, Command command, String completions.add(gameMode); } } - } else if (args.length == 2 && sender instanceof Player) { + } else if (args.length == 2) { String partialName = args[1].toLowerCase(); for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { String playerName = onlinePlayer.getName(); diff --git a/src/main/java/me/ghostdevelopment/kore/commands/commands/player/CommandSpawn.java b/src/main/java/me/ghostdevelopment/kore/commands/commands/player/CommandSpawn.java index 84c4ecc..6b435ac 100644 --- a/src/main/java/me/ghostdevelopment/kore/commands/commands/player/CommandSpawn.java +++ b/src/main/java/me/ghostdevelopment/kore/commands/commands/player/CommandSpawn.java @@ -18,7 +18,7 @@ @SuppressWarnings("ALL") -@CommandInfo(name = "spawn", permission = "kore.spawn", tabCompleter = true) +@CommandInfo(name = "spawn", permission = "kore.spawn", permission2 = "kore.spawn.other", tabCompleter = true) public class CommandSpawn extends KoreCommand { @Override @@ -70,11 +70,18 @@ public void execute(CommandSender sender, String[] args) { ||StorageFile.getFile().contains("spawn.yaw") ||StorageFile.getFile().contains("spawn.pitch") ) { - Location spawn = Functions.getSpawnLocation(); - target.teleport(spawn); - player.sendMessage(Color.Color(LangFile.getFile().getString("spawn.teleported") - .replaceAll("%prefix%", LangFile.getFile().getString("prefix")) - )); + if(player.hasPermission("kore.spawn.other")) { + Location spawn = Functions.getSpawnLocation(); + target.teleport(spawn); + player.sendMessage(Color.Color(LangFile.getFile().getString("spawn.teleported") + .replaceAll("%prefix%", LangFile.getFile().getString("prefix")) + )); + }else{ + player.sendMessage(Color.Color(LangFile.getFile().getString("no-permissions") + .replaceAll("%prefix%", LangFile.getFile().getString("prefix")) + )); + return; + } }else{ player.sendMessage(Color.Color(LangFile.getFile().getString("spawn.nonexistent") .replaceAll("%prefix%", LangFile.getFile().getString("prefix")) diff --git a/src/main/resources/lang/al.yml b/src/main/resources/lang/al.yml index bde1196..7e22464 100644 --- a/src/main/resources/lang/al.yml +++ b/src/main/resources/lang/al.yml @@ -29,7 +29,7 @@ teleport: teleported-other: "%prefix% &aU teleportua %player% te %loc%" usage: player: "%prefix% &cPërdorimi: /teleport &1[player| x y z ]" - console: "%prefix% &cPërdorimi: /teleport " + console: "%prefix% &cPërdorimi: /teleport " god: enabled: "%prefix% &aGodmode aktivizuar." disabled: "%prefix% &cGodmode çaktivizuar." diff --git a/src/main/resources/lang/cz.yml b/src/main/resources/lang/cz.yml index 7b86838..88edfd8 100644 --- a/src/main/resources/lang/cz.yml +++ b/src/main/resources/lang/cz.yml @@ -29,7 +29,7 @@ teleport: teleported-other: "%prefix% &aTeleportován %player% k %loc%" usage: player: "%prefix% &cPoužití: /teleport &1[player| x y z ]" - console: "%prefix% &cPoužití: /teleport " + console: "%prefix% &cPoužití: /teleport " god: enabled: "%prefix% &aMód bůh povolen." disabled: "%prefix% &cMód bůh zakázán." diff --git a/src/main/resources/lang/de.yml b/src/main/resources/lang/de.yml index 4e35df5..f5a5425 100644 --- a/src/main/resources/lang/de.yml +++ b/src/main/resources/lang/de.yml @@ -29,7 +29,7 @@ teleport: teleported-other: "%prefix% &aTeleportiert %player% zu %loc%" usage: player: "%prefix% &cVerwendung: /teleport &1[spieler| x y z ]" - console: "%prefix% &cVerwendung: /teleport " + console: "%prefix% &cVerwendung: /teleport " god: enabled: "%prefix% &aGottmodus aktiviert." disabled: "%prefix% &cGottmodus deaktiviert." diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml index eef61e4..639dd58 100644 --- a/src/main/resources/lang/en.yml +++ b/src/main/resources/lang/en.yml @@ -29,7 +29,7 @@ teleport: teleported-other: "%prefix% &aTeleported %player% to %loc%" usage: player: "%prefix% &cUsage: /teleport &1[player| x y z ]" - console: "%prefix% &cUsage: /teleport " + console: "%prefix% &cUsage: /teleport " god: enabled: "%prefix% &aGodmode enabled." disabled: "%prefix% &cGodmode disabled." diff --git a/src/main/resources/lang/es.yml b/src/main/resources/lang/es.yml index 63a2462..d2d596a 100644 --- a/src/main/resources/lang/es.yml +++ b/src/main/resources/lang/es.yml @@ -29,7 +29,7 @@ teleport: teleported-other: "%prefix% &aTeletransportó a %player% a %loc%" usage: player: "%prefix% &cUso: /teleport &1[jugador| x y z ]" - console: "%prefix% &cUso: /teleport " + console: "%prefix% &cUso: /teleport " god: enabled: "%prefix% &aModo dios habilitado." disabled: "%prefix% &cModo dios deshabilitado." diff --git a/src/main/resources/lang/fr.yml b/src/main/resources/lang/fr.yml index 28e90a2..4bfcad6 100644 --- a/src/main/resources/lang/fr.yml +++ b/src/main/resources/lang/fr.yml @@ -29,7 +29,7 @@ teleport: teleported-other: "%prefix% &aTéléporté %player% à %loc%" usage: player: "%prefix% &cUtilisation: /teleport &1[joueur| x y z ]" - console: "%prefix% &cUtilisation: /teleport " + console: "%prefix% &cUtilisation: /teleport " god: enabled: "%prefix% &aMode Dieu activé." disabled: "%prefix% &cMode Dieu désactivé." diff --git a/src/main/resources/lang/it.yml b/src/main/resources/lang/it.yml index cf59729..b65c285 100644 --- a/src/main/resources/lang/it.yml +++ b/src/main/resources/lang/it.yml @@ -29,7 +29,7 @@ teleport: teleported-other: "%prefix% &aTeletrasportato %player% a %loc%" usage: player: "%prefix% &cUso: /teleport &1[player| x y z ]" - console: "%prefix% &cUso: /teleport " + console: "%prefix% &cUso: /teleport " god: enabled: "%prefix% &aGodmode abilitata." disabled: "%prefix% &cGodmode disabilitata." diff --git a/src/main/resources/lang/ru.yml b/src/main/resources/lang/ru.yml index ce82ae2..87933d9 100644 --- a/src/main/resources/lang/ru.yml +++ b/src/main/resources/lang/ru.yml @@ -29,7 +29,7 @@ teleport: teleported-other: "%prefix% &a%player% телепортирован к %loc%" usage: player: "%prefix% &cИспользование: /teleport &1[player| x y z ]" - console: "%prefix% &cИспользование: /teleport " + console: "%prefix% &cИспользование: /teleport " god: enabled: "%prefix% &aРежим бога включен." disabled: "%prefix% &cРежим бога отключен." diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 5e493b8..962a36d 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -70,6 +70,8 @@ permissions: description: "" kore.spawn: description: "" + kore.spawn.other: + description: "" kore.trash: description: "" kore.chatbypass: @@ -96,3 +98,4 @@ permissions: description: "" kore.spawnmob: description: "" +