mirror of
https://github.com/Freezy-Studios/BlazeSMP.git
synced 2025-04-21 15:34:04 +02:00
Updated RestartCommand, Fixed claim and homes finally
This commit is contained in:
parent
e185f70437
commit
088ce798c6
3 changed files with 36 additions and 45 deletions
|
@ -58,23 +58,18 @@ public void onEnable() {
|
|||
BlazeSMP.instance = this;
|
||||
isEndOpen = getConfig().getBoolean("isEndOpen", false);
|
||||
|
||||
this.getServer().getScheduler().runTaskLater(this, () -> {
|
||||
this.log.info("Enabling BlazeSMP...");
|
||||
|
||||
|
||||
|
||||
this.getServer().getScheduler().runTaskLater(this, () -> {
|
||||
this.log.info("Loading Homes...");
|
||||
this.homes = new Homes();
|
||||
this.homes.load();
|
||||
this.log.info("Loaded Homes!");
|
||||
}, 20L);
|
||||
|
||||
this.getServer().getScheduler().runTaskLater(this, () -> {
|
||||
this.log.info("Loading Clans...");
|
||||
this.clans = new Clans();
|
||||
this.clans.loadAllClans();
|
||||
this.log.info("Loaded Clans!");
|
||||
}, 40L);
|
||||
|
||||
this.log.info("Registering Commands...");
|
||||
new ClanCommand().register();
|
||||
|
@ -109,6 +104,7 @@ public void onEnable() {
|
|||
this.log.info("Started Timer tasks!");
|
||||
|
||||
this.log.info("Enabled BlazeSMP!");
|
||||
}, 20L);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,18 +53,15 @@ public class ClaimCommand extends SimpleCommand {
|
|||
int MAX_CLAIMS = 50;
|
||||
if (playerClaims.size() >= MAX_CLAIMS) {
|
||||
player.sendMessage(MiniMessage.miniMessage().deserialize(L4M4.get("error.max_claims_reached")));
|
||||
System.out.println("Claim denied: max claims reached");
|
||||
} else {
|
||||
Chunk playerChunk = player.getLocation().getChunk();
|
||||
if (clans.isChunkClaimed(playerChunk)) {
|
||||
player.sendMessage(MiniMessage.miniMessage().deserialize(L4M4.get("error.chunk_already_claimed")));
|
||||
System.out.println("Claim denied: chunk already claimed");
|
||||
} else {
|
||||
// claim too close to spawn 8 chunks
|
||||
// claim too close to spawn 152 blocks in all directions
|
||||
if (Math.abs(player.getX()) < 152.0 && Math.abs(player.getZ()) < 152.0) {
|
||||
player.sendMessage(MiniMessage.miniMessage().deserialize(L4M4.get("error.chunk_too_close_to_spawn")));
|
||||
System.out.println("Claim denied: chunk too close to spawn");
|
||||
return true;
|
||||
}
|
||||
playerClaims.add(playerChunk);
|
||||
|
@ -73,7 +70,6 @@ public class ClaimCommand extends SimpleCommand {
|
|||
clans.setClanChunks(playerClan, existingClaims);
|
||||
playerClan.save();
|
||||
clans.saveAllClans();
|
||||
System.out.println("Chunk claimed successfully");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -90,10 +86,8 @@ public class ClaimCommand extends SimpleCommand {
|
|||
clans.setClanChunks(playerClan, existingClaims);
|
||||
playerClan.save();
|
||||
clans.saveAllClans();
|
||||
System.out.println("Chunk unclaimed successfully");
|
||||
} else {
|
||||
player.sendMessage(MiniMessage.miniMessage().deserialize(L4M4.get("error.chunk_not_owned")));
|
||||
System.out.println("Unclaim denied: chunk not owned");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package me.freezy.plugins.papermc.blazesmp.command;
|
|||
import me.freezy.plugins.papermc.blazesmp.BlazeSMP;
|
||||
import me.freezy.plugins.papermc.blazesmp.command.util.SimpleCommand;
|
||||
import me.freezy.plugins.papermc.blazesmp.module.manager.L4M4;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -31,9 +32,9 @@ public class RestartCommand extends SimpleCommand {
|
|||
}
|
||||
|
||||
String reason = String.join(" ", args);
|
||||
String kickMessage = MiniMessage.miniMessage().deserialize(reason).toString();
|
||||
Component kickMessage = MiniMessage.miniMessage().deserialize(reason);
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(player -> player.kickPlayer(kickMessage));
|
||||
Bukkit.getOnlinePlayers().forEach(player -> player.kick(kickMessage));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(BlazeSMP.getInstance(), Bukkit::shutdown, 60L); // 3 seconds later (60 ticks)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue