Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void onInteract(PlayerInteractEvent event) {
DisplayArena displayArena = session.getArena();

if (displayArena == null) {
player.sendMessage(Common.colorize("<red>Arena not found!"));
Common.sendMMMessage(player, "<red>Arena not found!");
setupManager.stopSetup(player);
return;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ private void handleModeSwitch(Player player, ArenaSetupManager.SetupSession sess
return;
}
setupManager.updateWand(player);
player.sendMessage(Common.colorize("<yellow>Switched to: <white>" + session.getCurrentMode().getDisplayName()));
Common.sendMMMessage(player, "<yellow>Switched to: <white>" + session.getCurrentMode().getDisplayName());
}

private void handleStandardPositions(Player player, Arena arena, Action action, PlayerInteractEvent event) {
Expand All @@ -145,7 +145,7 @@ private void handleStandardPositions(Player player, Arena arena, Action action,
if (action == Action.LEFT_CLICK_BLOCK) {
// Check minimum distance from position 2
if (arena.getPosition2() != null && arena.getPosition2().distance(loc) < 1.0) {
player.sendMessage(Common.colorize("<red>Spawn positions must be at least 1 block apart!"));
Common.sendMMMessage(player, "<red>Spawn positions must be at least 1 block apart!");
return;
}
arena.setPosition1(loc);
Expand All @@ -154,7 +154,7 @@ private void handleStandardPositions(Player player, Arena arena, Action action,
} else {
// Check minimum distance from position 1
if (arena.getPosition1() != null && arena.getPosition1().distance(loc) < 1.0) {
player.sendMessage(Common.colorize("<red>Spawn positions must be at least 1 block apart!"));
Common.sendMMMessage(player, "<red>Spawn positions must be at least 1 block apart!");
return;
}
arena.setPosition2(loc);
Expand Down Expand Up @@ -183,8 +183,8 @@ private void handleFFAPositions(Player player, FFAArena ffaArena, Action action,
// Check minimum distance from all existing spawns (must be at least 1 block apart)
for (Location existingSpawn : ffaArena.getFfaPositions()) {
if (existingSpawn.distance(loc) < 1.0) {
player.sendMessage(Common.colorize("<red>Spawn positions must be at least 1 block apart from each other!"));
player.sendMessage(Common.colorize("<gray>Too close to an existing spawn position."));
Common.sendMMMessage(player, "<red>Spawn positions must be at least 1 block apart from each other!");
Common.sendMMMessage(player, "<gray>Too close to an existing spawn position.");
return;
}
}
Expand All @@ -203,9 +203,9 @@ private void handleFFAPositions(Player player, FFAArena ffaArena, Action action,
ffaArena.getFfaPositions().remove(index);
SpawnMarkerManager.getInstance().updateMarkers(ffaArena);
updateGui(ffaArena);
player.sendMessage(Common.colorize("<red>Removed last FFA spawn point. Remaining: " + index));
Common.sendMMMessage(player, "<red>Removed last FFA spawn point. Remaining: " + index);
} else {
player.sendMessage(Common.colorize("<red>No spawn points to remove."));
Common.sendMMMessage(player, "<red>No spawn points to remove.");
}
}
}
Expand Down Expand Up @@ -330,7 +330,7 @@ private void handleBuildMax(Player player, DisplayArena arena, Action action) {
if (action.name().contains("LEFT")) {
arena.setBuildMax(false);
arena.setBuildMaxValue(ConfigManager.getInt("MATCH-SETTINGS.BUILD-LIMIT-DEFAULT"));
player.sendMessage(Common.colorize("<red>Build Height Limit disabled for " + arena.getName()));
Common.sendMMMessage(player, "<red>Build Height Limit disabled for " + arena.getName());
return;
}

Expand All @@ -352,7 +352,7 @@ private void handleDeadZone(Player player, DisplayArena arena, Action action) {

if (action.name().contains("LEFT")) {
arena.setDeadZone(false);
player.sendMessage(Common.colorize("<red>Dead Zone disabled for " + arena.getName()));
Common.sendMMMessage(player, "<red>Dead Zone disabled for " + arena.getName());
return;
}

Expand Down Expand Up @@ -550,34 +550,34 @@ public void onMarkerInteract(PlayerInteractAtEntityEvent event) {

// Check if player is in setup mode
if (!setupManager.isSettingUp(player)) {
player.sendMessage(Common.colorize("<red>You must be in setup mode to remove spawn markers."));
Common.sendMMMessage(player, "<red>You must be in setup mode to remove spawn markers.");
return;
}

// Find which arena this marker belongs to
DisplayArena arena = SpawnMarkerManager.getInstance().getArenaForMarker(mannequin);
if (arena == null) {
player.sendMessage(Common.colorize("<red>Could not find arena for this marker."));
Common.sendMMMessage(player, "<red>Could not find arena for this marker.");
return;
}

// ONLY allow for FFA arenas
if (!(arena instanceof FFAArena ffaArena)) {
player.sendMessage(Common.colorize("<red>Direct marker removal only works for FFA arenas."));
player.sendMessage(Common.colorize("<gray>Use left/right click on blocks to set standard arena spawn positions."));
Common.sendMMMessage(player, "<red>Direct marker removal only works for FFA arenas.");
Common.sendMMMessage(player, "<gray>Use left/right click on blocks to set standard arena spawn positions.");
return;
}

// Check if player is setting up this arena
ArenaSetupManager.SetupSession session = setupManager.getSession(player);
if (session == null || !session.getArena().equals(arena)) {
player.sendMessage(Common.colorize("<red>You are not currently setting up this arena."));
Common.sendMMMessage(player, "<red>You are not currently setting up this arena.");
return;
}

// Check if in correct mode
if (session.getCurrentMode() != SetupMode.FFA_POSITIONS) {
player.sendMessage(Common.colorize("<red>Switch to FFA Positions mode to remove spawn markers."));
Common.sendMMMessage(player, "<red>Switch to FFA Positions mode to remove spawn markers.");
return;
}

Expand All @@ -587,9 +587,9 @@ public void onMarkerInteract(PlayerInteractAtEntityEvent event) {
SpawnMarkerManager.getInstance().updateMarkers(arena);
updateGui(arena);

player.sendMessage(Common.colorize("<red>Removed FFA spawn. Remaining: " + ffaArena.getFfaPositions().size()));
Common.sendMMMessage(player, "<red>Removed FFA spawn. Remaining: " + ffaArena.getFfaPositions().size());
} else {
player.sendMessage(Common.colorize("<red>Failed to remove spawn marker."));
Common.sendMMMessage(player, "<red>Failed to remove spawn marker.");
}
}

Expand Down Expand Up @@ -629,9 +629,9 @@ public void onMarkerDamage(EntityDamageByEntityEvent event) {
ffaArena.getFfaPositions().remove(index);
SpawnMarkerManager.getInstance().updateMarkers(ffaArena);
updateGui(ffaArena);
player.sendMessage(Common.colorize("<red>Removed last FFA spawn point. Remaining: " + index));
Common.sendMMMessage(player, "<red>Removed last FFA spawn point. Remaining: " + index);
} else {
player.sendMessage(Common.colorize("<red>No spawn points to remove."));
Common.sendMMMessage(player, "<red>No spawn points to remove.");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public boolean startSetup(Player player, DisplayArena arena) {
// Show spawn position markers
SpawnMarkerManager.getInstance().showMarkers(arena);

player.sendMessage(Common.colorize("<green>Setup mode started for arena: <yellow>" + arena.getName() + "<green>."));
Common.sendMMMessage(player, "<green>Setup mode started for arena: <yellow>" + arena.getName() + "<green>.");
return true;
}

Expand All @@ -95,7 +95,7 @@ public void stopSetup(Player player) {
SpawnMarkerManager.getInstance().clearMarkers(arena);
}

player.sendMessage(Common.colorize("<red>Setup mode ended for arena: <red>" + arena.getName() + "."));
Common.sendMMMessage(player, "<red>Setup mode ended for arena: <red>" + arena.getName() + ".");
}

public SetupSession getSession(Player player) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static boolean changeStatus(Player player, DisplayArena arena) {
List<Player> editors = new ArrayList<>(setupManager.getPlayersSettingUpArena(arena));
for (Player editor : editors) {
setupManager.stopSetup(editor);
editor.sendMessage(Common.colorize("<red>Setup mode force ended because the arena has been <green>ENABLED<red>!"));
Common.sendMMMessage(editor, "<red>Setup mode force ended because the arena has been <green>ENABLED<red>!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public FFAEvent(Object starter, EventData eventData, String languagePath) {
public void teleport(final Player player) {
// Safety check: ensure spawns list is not empty
if (eventData.getSpawns() == null || eventData.getSpawns().isEmpty()) {
player.sendMessage(Common.colorize("<red>Error: No spawn points configured for this event!"));
Common.sendMMMessage(player, "<red>Error: No spawn points configured for this event!");
return;
}

Expand All @@ -49,7 +49,7 @@ public void teleport(final Player player) {

// Safety check: ensure spawn location is valid
if (spawnLocation == null || spawnLocation.getWorld() == null) {
player.sendMessage(Common.colorize("<red>Error: Invalid spawn location!"));
Common.sendMMMessage(player, "<red>Error: Invalid spawn location!");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void onInteract(PlayerInteractEvent event) {
EventData eventData = session.getEventData();

if (eventData == null) {
player.sendMessage(Common.colorize("<red>Event not found!"));
Common.sendMMMessage(player, "<red>Event not found!");
setupManager.stopSetup(player);
return;
}
Expand Down Expand Up @@ -193,7 +193,7 @@ public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
if (spawnIndex < 0 || spawnIndex >= eventData.getSpawns().size()) {
markerManager.updateMarkers(eventData);
updateGui(eventData);
player.sendMessage(Common.colorize("<red>This spawn marker is outdated. Markers have been refreshed."));
Common.sendMMMessage(player, "<red>This spawn marker is outdated. Markers have been refreshed.");
return;
}

Expand All @@ -202,7 +202,7 @@ public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
updateGui(eventData);
scheduleSave(eventData);

player.sendMessage(Common.colorize("<green>Removed spawn point #" + (spawnIndex + 1) + ". Remaining: " + eventData.getSpawns().size()));
Common.sendMMMessage(player, "<green>Removed spawn point #" + (spawnIndex + 1) + ". Remaining: " + eventData.getSpawns().size());
}

// Prevent damage to marker mannequins
Expand Down Expand Up @@ -244,9 +244,9 @@ public void onMarkerDamage(EntityDamageByEntityEvent event) {
EventSpawnMarkerManager.getInstance().updateMarkers(eventData);
updateGui(eventData);
scheduleSave(eventData);
player.sendMessage(Common.colorize("<red>Removed last spawn point. Remaining: " + index));
Common.sendMMMessage(player, "<red>Removed last spawn point. Remaining: " + index);
} else {
player.sendMessage(Common.colorize("<red>No spawn points to remove."));
Common.sendMMMessage(player, "<red>No spawn points to remove.");
}
}

Expand All @@ -270,7 +270,7 @@ private void handleModeSwitch(Player player, EventWandSetupManager.SetupSession
}

setupManager.updateWand(player);
player.sendMessage(Common.colorize("<yellow>Switched to mode: <white>" + session.getCurrentMode().getDisplayName()));
Common.sendMMMessage(player, "<yellow>Switched to mode: <white>" + session.getCurrentMode().getDisplayName());
}

private void handleCornerSelection(Player player, EventData eventData, Action action, PlayerInteractEvent event) {
Expand All @@ -281,7 +281,7 @@ private void handleCornerSelection(Player player, EventData eventData, Action ac

Block targetBlock = event.getClickedBlock();
if (targetBlock == null || targetBlock.getType().equals(Material.AIR)) {
player.sendMessage(Common.colorize("<red>Block location cannot be found!"));
Common.sendMMMessage(player, "<red>Block location cannot be found!");
return;
}

Expand Down Expand Up @@ -313,7 +313,7 @@ private void handleSpawnPoints(Player player, EventData eventData, Action action
}

if (eventData.getCuboid() == null) {
player.sendMessage(Common.colorize("<red>You must set corners first!"));
Common.sendMMMessage(player, "<red>You must set corners first!");
return;
}

Expand All @@ -325,23 +325,23 @@ private void handleSpawnPoints(Player player, EventData eventData, Action action
Location spawnLoc = getSnappedLocation(block, player);

if (!eventData.getCuboid().contains(spawnLoc)) {
player.sendMessage(Common.colorize("<red>Spawn point must be within the event cuboid!"));
Common.sendMMMessage(player, "<red>Spawn point must be within the event cuboid!");
return;
}

try {
eventData.addSpawn(spawnLoc);
} catch (IllegalStateException ex) {
// Ignore duplicate/invalid add attempts and show the setup error to the player.
player.sendMessage(Common.colorize("<red>" + ex.getMessage()));
Common.sendMMMessage(player, "<red>" + ex.getMessage());
return;
}

EventSpawnMarkerManager.getInstance().updateMarkers(eventData);
updateGui(eventData);
scheduleSave(eventData);

player.sendMessage(Common.colorize("<green>Added spawn point #" + eventData.getSpawns().size() + " at your location."));
Common.sendMMMessage(player, "<green>Added spawn point #" + eventData.getSpawns().size() + " at your location.");
}
// Left-click anywhere to remove the last spawn point
else if (action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) {
Expand All @@ -351,9 +351,9 @@ else if (action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) {
EventSpawnMarkerManager.getInstance().updateMarkers(eventData);
updateGui(eventData);
scheduleSave(eventData);
player.sendMessage(Common.colorize("<red>Removed last spawn point. Remaining: " + index));
Common.sendMMMessage(player, "<red>Removed last spawn point. Remaining: " + index);
} else {
player.sendMessage(Common.colorize("<red>No spawn points to remove."));
Common.sendMMMessage(player, "<red>No spawn points to remove.");
}
}
}
Expand All @@ -366,19 +366,19 @@ private void handleToggleStatus(Player player, EventData eventData, Action actio
try {
if (eventData.isEnabled()) {
eventData.setEnabled(false);
player.sendMessage(Common.colorize("<red>Disabled event: <yellow>" + eventData.getType().getName()));
Common.sendMMMessage(player, "<red>Disabled event: <yellow>" + eventData.getType().getName());
} else {
if (eventData.getCuboidLoc1() == null || eventData.getCuboidLoc2() == null) {
player.sendMessage(Common.colorize("<red>You must set both corners first!"));
Common.sendMMMessage(player, "<red>You must set both corners first!");
return;
}
if (eventData.getSpawns().isEmpty()) {
player.sendMessage(Common.colorize("<red>You must set at least one spawn point!"));
Common.sendMMMessage(player, "<red>You must set at least one spawn point!");
return;
}

eventData.setEnabled(true);
player.sendMessage(Common.colorize("<green>Enabled event: <yellow>" + eventData.getType().getName()));
Common.sendMMMessage(player, "<green>Enabled event: <yellow>" + eventData.getType().getName());

// End setup mode for all players currently setting up this event
List<Player> playersSettingUp = new ArrayList<>(setupManager.getPlayersSettingUpEvent(eventData));
Expand All @@ -390,7 +390,7 @@ private void handleToggleStatus(Player player, EventData eventData, Action actio
updateGui(eventData);
scheduleSave(eventData);
} catch (Exception e) {
player.sendMessage(Common.colorize("<red>Error toggling status: " + e.getMessage()));
Common.sendMMMessage(player, "<red>Error toggling status: " + e.getMessage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import dev.nandi0813.practice.util.Common;
import dev.nandi0813.practice.util.ItemCreateUtil;
import lombok.Getter;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
Expand Down Expand Up @@ -110,7 +109,7 @@ private Mannequin createMarker(Location location, String name) {
mannequin.setGravity(false);
mannequin.setCanPickupItems(false);
mannequin.setCustomNameVisible(true);
mannequin.customName(Component.text(Common.colorize(name)));
mannequin.customName(Common.deserializeMiniMessage(name));
mannequin.setAI(false);
mannequin.setCollidable(false);
mannequin.setSilent(true);
Expand Down Expand Up @@ -145,7 +144,7 @@ private Mannequin createLabelOnly(Location location) {
labelStand.setGravity(false);
labelStand.setCanPickupItems(false);
labelStand.setCustomNameVisible(true);
labelStand.customName(Component.text(Common.colorize("<gray>(Right-click to remove)")));
labelStand.customName(Common.deserializeMiniMessage("<gray>(Right-click to remove)"));
labelStand.setAI(false);
labelStand.setCollidable(false);
labelStand.setSilent(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void startSetup(Player player, EventData eventData) {
// Show spawn position markers
EventSpawnMarkerManager.getInstance().showMarkers(eventData);

player.sendMessage(Common.colorize("<green>Setup mode started for event: <yellow>" + eventData.getType().getName() + "<green>."));
Common.sendMMMessage(player, "<green>Setup mode started for event: <yellow>" + eventData.getType().getName() + "<green>.");
}

public void stopSetup(Player player) {
Expand All @@ -101,7 +101,7 @@ public void stopSetup(Player player) {
EventSpawnMarkerManager.getInstance().clearMarkers(eventData);
}

player.sendMessage(Common.colorize("<red>Setup mode ended for event: <red>" + eventData.getType().getName() + "."));
Common.sendMMMessage(player, "<red>Setup mode ended for event: <red>" + eventData.getType().getName() + ".");
}

public SetupSession getSession(Player player) {
Expand Down
Loading