package me.km.snuviscript.commands; import me.hammerle.snuviscript.code.ScriptManager; import me.hammerle.snuviscript.code.SnuviUtils; import me.km.networking.ModPacketHandler; import me.km.permissions.Permissions; import me.km.snuviscript.Scripts; import static me.km.snuviscript.commands.CommandUtils.doForGroup; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.server.MinecraftServer; public class DisplayCommands { public static void registerFunctions(ScriptManager sm, Scripts scripts, Permissions perms, MinecraftServer server) { sm.registerConsumer("display.add", (sc, in) -> { byte id = in[1].getByte(sc); String message = SnuviUtils.connect(sc, in, 2); doForGroup(server, scripts, perms, in[0].get(sc), sc, p -> ModPacketHandler.sendToDisplay((ServerPlayerEntity) p, (byte) 1, id, message)); }); sm.registerConsumer("display.remove", (sc, in) -> { byte id = in[1].getByte(sc); doForGroup(server, scripts, perms, in[0].get(sc), sc, p -> ModPacketHandler.sendToDisplay((ServerPlayerEntity) p, (byte) 2, id, "")); }); sm.registerConsumer("display.reset", (sc, in) -> { doForGroup(server, scripts, perms, in[0].get(sc), sc, p -> ModPacketHandler.sendToDisplay((ServerPlayerEntity) p, (byte) 3, (byte) -1, "")); }); } }