mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 14:38:52 +00:00
Add /edithome, use instant for timestamps, new locales
This commit is contained in:
1 parent
eddae1051c
commit
a91128ca3d
24 files changed
+793
-205
No files matched your search
@@ -12,6 +12,7 @@ public enum BukkitCommandType {
|
||||
SET_HOME_COMMAND(new SetHomeCommand(BukkitHuskHomes.getInstance())),
|
||||
HOME_LIST_COMMAND(new HomeListCommand(BukkitHuskHomes.getInstance())),
|
||||
DEL_HOME_COMMAND(new DelHomeCommand(BukkitHuskHomes.getInstance())),
|
||||
EDIT_HOME_COMMAND(new EditHomeCommand(BukkitHuskHomes.getInstance())),
|
||||
PUBLIC_HOME_COMMAND(new PublicHomeCommand(BukkitHuskHomes.getInstance())),
|
||||
PUBLIC_HOME_LIST_COMMAND(new PublicHomeListCommand(BukkitHuskHomes.getInstance())),
|
||||
WARP_COMMAND(new WarpCommand(BukkitHuskHomes.getInstance())),
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.william278.huskhomes.player;
|
||||
import de.themoep.minedown.MineDown;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.william278.huskhomes.BukkitHuskHomes;
|
||||
import net.william278.huskhomes.position.Location;
|
||||
import net.william278.huskhomes.position.Position;
|
||||
@@ -96,7 +97,11 @@ public class BukkitPlayer extends OnlineUser {
|
||||
|
||||
@Override
|
||||
public void sendMessage(@NotNull MineDown mineDown) {
|
||||
player.spigot().sendMessage(mineDown.replace().toComponent());
|
||||
final BaseComponent[] messageComponents = mineDown.replace().toComponent();
|
||||
if (messageComponents.length == 0) {
|
||||
return;
|
||||
}
|
||||
player.spigot().sendMessage(messageComponents);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,7 +152,7 @@ public class BukkitPlayer extends OnlineUser {
|
||||
/**
|
||||
* Send a Bukkit plugin message
|
||||
*/
|
||||
public void sendPluginMessage(@NotNull Plugin source, @NotNull String channel, @NotNull byte[] message) {
|
||||
public void sendPluginMessage(@NotNull Plugin source, @NotNull String channel, final byte[] message) {
|
||||
player.sendPluginMessage(source, channel, message);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ commands:
|
||||
usage: /homelist [page]
|
||||
delhome:
|
||||
usage: /delhome <name>
|
||||
edithome:
|
||||
usage: /edithome <name> [rename|description|relocate|privacy] [args]
|
||||
publichome:
|
||||
usage: /publichome [<owner_name>.<home_name>]
|
||||
publichomelist:
|
||||
|
||||
@@ -3,15 +3,17 @@ package net.william278.huskhomes;
|
||||
import be.seeseemelk.mockbukkit.MockBukkit;
|
||||
import be.seeseemelk.mockbukkit.ServerMock;
|
||||
import be.seeseemelk.mockbukkit.entity.PlayerMock;
|
||||
import de.themoep.minedown.MineDown;
|
||||
import net.william278.huskhomes.command.BukkitCommandType;
|
||||
import net.william278.huskhomes.player.BukkitPlayer;
|
||||
import net.william278.huskhomes.position.Home;
|
||||
import net.william278.huskhomes.position.PositionMeta;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Uses MockBukkit to test the plugin on a mock Paper server implementing the Bukkit 1.19 API.
|
||||
*/
|
||||
@@ -51,4 +53,22 @@ public class BukkitPluginTests {
|
||||
Assertions.assertNotNull(BukkitPlayer.adapt(player));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocalesLoading() {
|
||||
final Map<String, String> rawLocales = plugin.getLocales().rawLocales;
|
||||
Assertions.assertTrue(rawLocales.size() > 0);
|
||||
rawLocales.forEach((key, value) -> Assertions.assertNotNull(value));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocaleParsing() {
|
||||
final Map<String, String> rawLocales = plugin.getLocales().rawLocales;
|
||||
BukkitPlayer bukkitPlayer = BukkitPlayer.adapt(server.addPlayer());
|
||||
rawLocales.forEach((key, value) -> {
|
||||
Optional<MineDown> locale = plugin.getLocales().getLocale(key);
|
||||
Assertions.assertTrue(locale.isPresent());
|
||||
bukkitPlayer.sendMessage(locale.get());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user