Skip to content

Commit

Permalink
09-09-Sat 05:28
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostAndry committed Sep 9, 2023
1 parent d3d9ecb commit 471e1b2
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 26 deletions.
36 changes: 32 additions & 4 deletions src/main/java/me/ghostdevelopment/kore/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -30,6 +29,10 @@ public static void reloadFiles(){

}

public static void updatePlugin(){
// SOON
}

// /////////////////////////////////////////////////////////////////////////////////////////////////////

public static void setSpawnLoc(Location loc){
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -80,7 +80,7 @@ public void execute(CommandSender sender, String[] args) {
"&7/spawnmob &c<mob> &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) {

Expand Down Expand Up @@ -199,6 +199,7 @@ public List<String> 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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <player>
if(args.length==1){

Player target = Bukkit.getPlayer(args[0]);
Expand Down Expand Up @@ -154,7 +153,7 @@ public List<String> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -222,7 +222,7 @@ public List<String> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang/al.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ teleport:
teleported-other: "%prefix% &aU teleportua %player% te %loc%"
usage:
player: "%prefix% &cPërdorimi: /teleport <player| x y z > &1[player| x y z ]"
console: "%prefix% &cPërdorimi: /teleport <player| x y z > <player| x y z >"
console: "%prefix% &cPërdorimi: /teleport <player| x y z > <player>"
god:
enabled: "%prefix% &aGodmode aktivizuar."
disabled: "%prefix% &cGodmode çaktivizuar."
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang/cz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ teleport:
teleported-other: "%prefix% &aTeleportován %player% k %loc%"
usage:
player: "%prefix% &cPoužití: /teleport <player| x y z > &1[player| x y z ]"
console: "%prefix% &cPoužití: /teleport <player| x y z > <player| x y z >"
console: "%prefix% &cPoužití: /teleport <player| x y z > <player>"
god:
enabled: "%prefix% &aMód bůh povolen."
disabled: "%prefix% &cMód bůh zakázán."
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ teleport:
teleported-other: "%prefix% &aTeleportiert %player% zu %loc%"
usage:
player: "%prefix% &cVerwendung: /teleport <spieler| x y z > &1[spieler| x y z ]"
console: "%prefix% &cVerwendung: /teleport <spieler| x y z > <spieler| x y z >"
console: "%prefix% &cVerwendung: /teleport <spieler| x y z > <spieler>"
god:
enabled: "%prefix% &aGottmodus aktiviert."
disabled: "%prefix% &cGottmodus deaktiviert."
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ teleport:
teleported-other: "%prefix% &aTeleported %player% to %loc%"
usage:
player: "%prefix% &cUsage: /teleport <player| x y z > &1[player| x y z ]"
console: "%prefix% &cUsage: /teleport <player| x y z > <player| x y z >"
console: "%prefix% &cUsage: /teleport <player| x y z > <player>"
god:
enabled: "%prefix% &aGodmode enabled."
disabled: "%prefix% &cGodmode disabled."
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ teleport:
teleported-other: "%prefix% &aTeletransportó a %player% a %loc%"
usage:
player: "%prefix% &cUso: /teleport <jugador| x y z > &1[jugador| x y z ]"
console: "%prefix% &cUso: /teleport <jugador| x y z > <jugador| x y z >"
console: "%prefix% &cUso: /teleport <jugador| x y z > <jugador>"
god:
enabled: "%prefix% &aModo dios habilitado."
disabled: "%prefix% &cModo dios deshabilitado."
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ teleport:
teleported-other: "%prefix% &aTéléporté %player% à %loc%"
usage:
player: "%prefix% &cUtilisation: /teleport <joueur| x y z > &1[joueur| x y z ]"
console: "%prefix% &cUtilisation: /teleport <joueur| x y z > <joueur| x y z >"
console: "%prefix% &cUtilisation: /teleport <joueur| x y z > <joueur>"
god:
enabled: "%prefix% &aMode Dieu activé."
disabled: "%prefix% &cMode Dieu désactivé."
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ teleport:
teleported-other: "%prefix% &aTeletrasportato %player% a %loc%"
usage:
player: "%prefix% &cUso: /teleport <player| x y z > &1[player| x y z ]"
console: "%prefix% &cUso: /teleport <player| x y z > <player| x y z >"
console: "%prefix% &cUso: /teleport <player| x y z > <player>"
god:
enabled: "%prefix% &aGodmode abilitata."
disabled: "%prefix% &cGodmode disabilitata."
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ teleport:
teleported-other: "%prefix% &a%player% телепортирован к %loc%"
usage:
player: "%prefix% &cИспользование: /teleport <player| x y z > &1[player| x y z ]"
console: "%prefix% &cИспользование: /teleport <player| x y z > <player| x y z >"
console: "%prefix% &cИспользование: /teleport <player| x y z > <player>"
god:
enabled: "%prefix% &aРежим бога включен."
disabled: "%prefix% &cРежим бога отключен."
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ permissions:
description: ""
kore.spawn:
description: ""
kore.spawn.other:
description: ""
kore.trash:
description: ""
kore.chatbypass:
Expand All @@ -96,3 +98,4 @@ permissions:
description: ""
kore.spawnmob:
description: ""

0 comments on commit 471e1b2

Please sign in to comment.