Added the /homes Command to see the current homes.
This commit is contained in:
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.user404_"
|
group = "com.user404_"
|
||||||
version = "1.0-SNAPSHOT"
|
version = "1.0.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@@ -27,6 +28,12 @@ public class InfiniteHomes extends JavaPlugin {
|
|||||||
homes = new HashMap<>();
|
homes = new HashMap<>();
|
||||||
setupHomesConfig();
|
setupHomesConfig();
|
||||||
loadHomesFromConfig();
|
loadHomesFromConfig();
|
||||||
|
|
||||||
|
// Standardkonfiguration erstellen, falls nicht vorhanden
|
||||||
|
getConfig().addDefault("max-homes", -1);
|
||||||
|
getConfig().options().copyDefaults(true);
|
||||||
|
saveConfig();
|
||||||
|
|
||||||
getLogger().info("InfiniteHomes plugin enabled!");
|
getLogger().info("InfiniteHomes plugin enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,6 +172,33 @@ public class InfiniteHomes extends JavaPlugin {
|
|||||||
return true;
|
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 (cmd.getName().equalsIgnoreCase("homecount")) {
|
||||||
if (!player.isOp()) {
|
if (!player.isOp()) {
|
||||||
player.sendMessage("§cYou do not have permission to use this command.");
|
player.sendMessage("§cYou do not have permission to use this command.");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: InfiniteHomes
|
name: InfiniteHomes
|
||||||
version: 1.0
|
version: 1.0.1
|
||||||
main: com.user404_.infinitehomes.InfiniteHomes
|
main: com.user404.infinitehomes.InfiniteHomes
|
||||||
api-version: 1.21
|
api-version: 1.16
|
||||||
commands:
|
commands:
|
||||||
sethome:
|
sethome:
|
||||||
description: Set a home with the given name.
|
description: Set a home with the given name.
|
||||||
@@ -12,6 +12,9 @@ commands:
|
|||||||
home:
|
home:
|
||||||
description: Teleport to a home with the given name.
|
description: Teleport to a home with the given name.
|
||||||
usage: /home <name>
|
usage: /home <name>
|
||||||
|
homes:
|
||||||
|
description: List all your homes.
|
||||||
|
usage: /homes
|
||||||
homecount:
|
homecount:
|
||||||
description: Set the global home limit (OP only).
|
description: Set the global home limit (OP only).
|
||||||
usage: /homecount <number>
|
usage: /homecount <number>
|
||||||
Reference in New Issue
Block a user