Added the /homes Command to see the current homes.
This commit is contained in:
@@ -3,7 +3,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "com.user404_"
|
||||
version = "1.0-SNAPSHOT"
|
||||
version = "1.0.1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@@ -27,6 +28,12 @@ public class InfiniteHomes extends JavaPlugin {
|
||||
homes = new HashMap<>();
|
||||
setupHomesConfig();
|
||||
loadHomesFromConfig();
|
||||
|
||||
// Standardkonfiguration erstellen, falls nicht vorhanden
|
||||
getConfig().addDefault("max-homes", -1);
|
||||
getConfig().options().copyDefaults(true);
|
||||
saveConfig();
|
||||
|
||||
getLogger().info("InfiniteHomes plugin enabled!");
|
||||
}
|
||||
|
||||
@@ -165,6 +172,33 @@ public class InfiniteHomes extends JavaPlugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("homes")) {
|
||||
// List all homes of the player
|
||||
if (!homes.containsKey(playerUuid) || homes.get(playerUuid).isEmpty()) {
|
||||
player.sendMessage("§cYou don't have any homes set.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Set<String> homeNames = homes.get(playerUuid).keySet();
|
||||
int maxHomes = getConfig().getInt("max-homes", -1);
|
||||
int currentHomes = homeNames.size();
|
||||
|
||||
String limitText = (maxHomes == -1) ? "unlimited" : String.valueOf(maxHomes);
|
||||
player.sendMessage("§aYour homes (§e" + currentHomes + "§a/§e" + limitText + "§a):");
|
||||
|
||||
// List all home names
|
||||
StringBuilder homesList = new StringBuilder();
|
||||
for (String home : homeNames) {
|
||||
if (homesList.length() > 0) {
|
||||
homesList.append("§a, ");
|
||||
}
|
||||
homesList.append("§e").append(home);
|
||||
}
|
||||
|
||||
player.sendMessage(homesList.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cmd.getName().equalsIgnoreCase("homecount")) {
|
||||
if (!player.isOp()) {
|
||||
player.sendMessage("§cYou do not have permission to use this command.");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: InfiniteHomes
|
||||
version: 1.0
|
||||
main: com.user404_.infinitehomes.InfiniteHomes
|
||||
api-version: 1.21
|
||||
version: 1.0.1
|
||||
main: com.user404.infinitehomes.InfiniteHomes
|
||||
api-version: 1.16
|
||||
commands:
|
||||
sethome:
|
||||
description: Set a home with the given name.
|
||||
@@ -12,6 +12,9 @@ commands:
|
||||
home:
|
||||
description: Teleport to a home with the given name.
|
||||
usage: /home <name>
|
||||
homes:
|
||||
description: List all your homes.
|
||||
usage: /homes
|
||||
homecount:
|
||||
description: Set the global home limit (OP only).
|
||||
usage: /homecount <number>
|
||||
Reference in New Issue
Block a user