├── main └── src │ └── main │ ├── java │ └── su │ │ └── nightexpress │ │ └── nightcore │ │ ├── locale │ │ ├── LangContainer.java │ │ ├── message │ │ │ ├── MessageType.java │ │ │ └── impl │ │ │ │ ├── SilentMessage.java │ │ │ │ └── ActionBarMessage.java │ │ ├── LangDefaults.java │ │ ├── LangValue.java │ │ └── LangElement.java │ │ ├── util │ │ ├── geodata │ │ │ ├── DimensionType.java │ │ │ └── GeoUtils.java │ │ ├── time │ │ │ └── TimeFormatType.java │ │ ├── text │ │ │ ├── tag │ │ │ │ ├── decorator │ │ │ │ │ ├── ColorDecorator.java │ │ │ │ │ ├── Decorator.java │ │ │ │ │ ├── BaseColorDecorator.java │ │ │ │ │ └── FontDecorator.java │ │ │ │ ├── api │ │ │ │ │ ├── PlaceholderTag.java │ │ │ │ │ ├── ContentTag.java │ │ │ │ │ ├── SimpleTag.java │ │ │ │ │ └── ComplexTag.java │ │ │ │ └── impl │ │ │ │ │ ├── ResetTag.java │ │ │ │ │ ├── FontTag.java │ │ │ │ │ ├── LineBreakTag.java │ │ │ │ │ ├── TranslationTag.java │ │ │ │ │ └── ShortHexColorTag.java │ │ │ ├── TextChildren.java │ │ │ └── LangNode.java │ │ ├── placeholder │ │ │ ├── PlaceholderResolvable.java │ │ │ ├── PlaceholderResolver.java │ │ │ ├── Placeholder.java │ │ │ └── PlaceholderEntry.java │ │ ├── TriFunction.java │ │ ├── regex │ │ │ ├── MatcherTimeoutException.java │ │ │ └── TimeoutCharSequence.java │ │ ├── random │ │ │ └── WeightedItem.java │ │ ├── number │ │ │ └── CompactNumber.java │ │ ├── blocktracker │ │ │ └── TrackUtil.java │ │ ├── BossBarUtils.java │ │ ├── Pair.java │ │ └── wrapper │ │ │ └── UniPermission.java │ │ ├── db │ │ ├── config │ │ │ └── DatabaseType.java │ │ ├── query │ │ │ ├── Query.java │ │ │ └── TypedValue.java │ │ ├── sql │ │ │ ├── query │ │ │ │ ├── type │ │ │ │ │ ├── ValuedQuery.java │ │ │ │ │ └── AbstractQuery.java │ │ │ │ ├── QueryValue.java │ │ │ │ └── impl │ │ │ │ │ └── DeleteQuery.java │ │ │ ├── util │ │ │ │ ├── WhereOperator.java │ │ │ │ └── SQLUtils.java │ │ │ └── column │ │ │ │ └── ColumnType.java │ │ └── connection │ │ │ └── impl │ │ │ ├── SQLiteConnector.java │ │ │ └── MySQLConnector.java │ │ ├── database │ │ ├── DatabaseType.java │ │ ├── sql │ │ │ ├── SQLExecutor.java │ │ │ ├── SQLValue.java │ │ │ ├── column │ │ │ │ ├── ColumnType.java │ │ │ │ └── ColumnFormer.java │ │ │ └── SQLUtils.java │ │ ├── connection │ │ │ ├── SQLiteConnector.java │ │ │ └── MySQLConnector.java │ │ ├── serialize │ │ │ └── ItemStackSerializer.java │ │ └── DataUser.java │ │ ├── language │ │ ├── message │ │ │ └── OutputType.java │ │ ├── entry │ │ │ ├── LangElement.java │ │ │ └── LangEntry.java │ │ └── tag │ │ │ ├── impl │ │ │ ├── NoPrefixTag.java │ │ │ └── PlaceholderTag.java │ │ │ └── MessageTag.java │ │ ├── config │ │ ├── Writeable.java │ │ └── ReadFunction.java │ │ ├── ui │ │ ├── dialog │ │ │ ├── DialogHandler.java │ │ │ ├── DialogListener.java │ │ │ └── build │ │ │ │ └── DialogActions.java │ │ ├── inventory │ │ │ ├── action │ │ │ │ ├── ObjectAction.java │ │ │ │ ├── MenuItemAction.java │ │ │ │ ├── MenuItemActions.java │ │ │ │ ├── ObjectActionContext.java │ │ │ │ ├── ActionContext.java │ │ │ │ └── ActionRegistry.java │ │ │ ├── condition │ │ │ │ ├── ItemStateCondition.java │ │ │ │ ├── ItemStateConditions.java │ │ │ │ └── ConditionRegistry.java │ │ │ ├── item │ │ │ │ └── DisplayModifier.java │ │ │ ├── menu │ │ │ │ └── AbstractMenu.java │ │ │ └── viewer │ │ │ │ └── ViewerContext.java │ │ ├── menu │ │ │ ├── item │ │ │ │ └── ItemClick.java │ │ │ ├── data │ │ │ │ ├── LinkHandler.java │ │ │ │ ├── Filled.java │ │ │ │ └── ConfigBased.java │ │ │ ├── type │ │ │ │ └── NormalMenu.java │ │ │ └── click │ │ │ │ ├── ClickResult.java │ │ │ │ └── ClickKey.java │ │ └── UIUtils.java │ │ ├── integration │ │ ├── permission │ │ │ ├── PermissionPlugins.java │ │ │ ├── PermissionBridge.java │ │ │ └── PermissionProvider.java │ │ ├── currency │ │ │ ├── CurrencyPlugins.java │ │ │ ├── listener │ │ │ │ └── CurrencyListener.java │ │ │ └── type │ │ │ │ └── IncompleteCurrency.java │ │ └── item │ │ │ ├── ItemPlugins.java │ │ │ ├── adapter │ │ │ ├── AbstractItemAdapter.java │ │ │ └── impl │ │ │ │ ├── NexoAdapter.java │ │ │ │ ├── OraxenAdapter.java │ │ │ │ └── ItemsAdderAdapter.java │ │ │ ├── impl │ │ │ └── AdaptedCustomStack.java │ │ │ └── data │ │ │ └── ItemIdData.java │ │ ├── dialog │ │ └── DialogHandler.java │ │ ├── command │ │ ├── experimental │ │ │ ├── node │ │ │ │ ├── NodeExecutor.java │ │ │ │ └── DirectExecutor.java │ │ │ ├── argument │ │ │ │ ├── ParsedArgument.java │ │ │ │ └── ArgumentParser.java │ │ │ ├── ServerCommand.java │ │ │ ├── flag │ │ │ │ └── SimpleFlag.java │ │ │ ├── ImprovedCommands.java │ │ │ └── builder │ │ │ │ ├── SimpleFlagBuilder.java │ │ │ │ ├── FlagBuilder.java │ │ │ │ └── ContentFlagBuilder.java │ │ ├── impl │ │ │ └── BaseCommand.java │ │ ├── api │ │ │ └── NightPluginCommand.java │ │ └── base │ │ │ └── ReloadSubCommand.java │ │ ├── manager │ │ ├── SimpeListener.java │ │ ├── AbstractListener.java │ │ ├── FileBacked.java │ │ ├── ConfigBacked.java │ │ └── SimpleManager.java │ │ ├── menu │ │ ├── click │ │ │ ├── ClickAction.java │ │ │ └── ClickResult.java │ │ ├── MenuSize.java │ │ └── link │ │ │ ├── Linked.java │ │ │ └── ViewLink.java │ │ ├── commands │ │ ├── NodeExecutor.java │ │ ├── SuggestionsProvider.java │ │ ├── argument │ │ │ ├── ArgumentType.java │ │ │ └── type │ │ │ │ ├── PlayerNameArgumentType.java │ │ │ │ ├── BoolArgumentType.java │ │ │ │ ├── StringArgumentType.java │ │ │ │ ├── WorldArgumentType.java │ │ │ │ └── PlayerArgumentType.java │ │ ├── command │ │ │ ├── HubCommand.java │ │ │ └── LiteralCommand.java │ │ ├── context │ │ │ ├── ParsedArgument.java │ │ │ ├── Suggestions.java │ │ │ └── ParsedCommandNode.java │ │ ├── tree │ │ │ └── ExecutableNode.java │ │ ├── CommandRequirement.java │ │ ├── exceptions │ │ │ └── CommandSyntaxException.java │ │ └── builder │ │ │ └── NodeBuilder.java │ │ ├── NightCoreBootstrap.java │ │ ├── core │ │ ├── CoreLogger.java │ │ ├── tag │ │ │ └── ColorCode.java │ │ ├── CorePerms.java │ │ └── listener │ │ │ └── CoreListener.java │ │ ├── NightDataPlugin.java │ │ ├── configuration │ │ └── AbstractConfig.java │ │ ├── Engine.java │ │ ├── event │ │ ├── MenuOpenEvent.java │ │ └── PlayerOpenMenuEvent.java │ │ ├── api │ │ └── event │ │ │ └── MenuOpenEvent.java │ │ └── NightCoreLoader.java │ └── resources │ ├── plugin.yml │ └── paper-plugin.yml ├── bridge └── src │ └── main │ └── java │ └── su │ └── nightexpress │ └── nightcore │ ├── util │ ├── text │ │ └── night │ │ │ ├── ParserMode.java │ │ │ ├── entry │ │ │ ├── Entry.java │ │ │ ├── ChildEntry.java │ │ │ ├── KeybindEntry.java │ │ │ ├── PlayerHeadEntry.java │ │ │ ├── LangEntry.java │ │ │ ├── TextEntry.java │ │ │ └── SpriteEntry.java │ │ │ ├── tag │ │ │ ├── TagHandler.java │ │ │ ├── handler │ │ │ │ ├── ResetTagHandler.java │ │ │ │ ├── FontTagHandler.java │ │ │ │ ├── InsertionTagHandler.java │ │ │ │ ├── PlaceholderTagHandler.java │ │ │ │ ├── KeybindTagHandler.java │ │ │ │ ├── ColorTagHandler.java │ │ │ │ ├── ClassicTagHandler.java │ │ │ │ ├── NamedColorTagHandler.java │ │ │ │ ├── DecorationTagHandler.java │ │ │ │ ├── ShadowTagHandler.java │ │ │ │ └── LangTagHandler.java │ │ │ ├── TagContent.java │ │ │ └── TagPool.java │ │ │ └── wrapper │ │ │ ├── TagWrapper.java │ │ │ └── SimpleTagWrapper.java │ └── bridge │ │ └── wrapper │ │ ├── HoverEventType.java │ │ ├── ComponentBuildable.java │ │ └── ClickEventType.java │ └── bridge │ ├── bossbar │ ├── NightBarFlag.java │ ├── NightBarOverlay.java │ └── NightBarColor.java │ ├── dialog │ ├── wrap │ │ ├── base │ │ │ └── WrappedDialogAfterAction.java │ │ ├── input │ │ │ ├── text │ │ │ │ └── WrappedMultilineOptions.java │ │ │ ├── single │ │ │ │ └── WrappedSingleOptionEntry.java │ │ │ └── WrappedDialogInput.java │ │ ├── action │ │ │ ├── WrappedDialogAction.java │ │ │ ├── WrappedDialogCommandTemplateAction.java │ │ │ ├── WrappedDialogStaticAction.java │ │ │ └── WrappedDialogCustomAction.java │ │ ├── body │ │ │ ├── WrappedDialogBody.java │ │ │ └── WrappedPlainMessageDialogBody.java │ │ └── type │ │ │ ├── WrappedDialogType.java │ │ │ ├── WrappedNoticeType.java │ │ │ ├── WrappedConfirmationType.java │ │ │ └── WrappedServerLinksType.java │ ├── response │ │ ├── DialogClickHandler.java │ │ ├── DialogResponseHandler.java │ │ └── DialogClickResult.java │ ├── adapter │ │ ├── DialogAdapter.java │ │ ├── DialogBaseAdapter.java │ │ ├── DialogButtonAdapter.java │ │ ├── DialogBodyAdapter.java │ │ ├── DialogTypeAdapter.java │ │ ├── DialogActionAdapter.java │ │ └── DialogInputAdapter.java │ ├── DialogViewer.java │ ├── DialogKeys.java │ └── DialogDefaults.java │ ├── chat │ ├── UniversalChatEventHandler.java │ ├── UniversalChatListenerCallback.java │ ├── UniversalChatRenderer.java │ └── UniversalChatEvent.java │ ├── Registries.java │ ├── wrap │ ├── NightSound.java │ └── NightProfile.java │ ├── item │ ├── AdaptedItem.java │ └── ItemAdapter.java │ ├── text │ ├── adapter │ │ ├── ObjectContentsAdapter.java │ │ └── TextComponentAdapter.java │ ├── NightTextDecoration.java │ └── event │ │ └── WrappedPayload.java │ ├── registry │ └── Holder.java │ └── currency │ └── Currency.java ├── .gitignore ├── utils └── src │ └── main │ └── java │ └── su │ └── nightexpress │ └── nightcore │ └── util │ ├── problem │ ├── Problem.java │ └── ProblemReporter.java │ ├── ServerUtils.java │ ├── LowerCase.java │ ├── nbt │ └── NbtOps.java │ └── Enums.java ├── paper └── src │ └── main │ └── java │ └── su │ └── nightexpress │ └── nightcore │ └── bridge │ └── paper │ ├── text │ └── PaperAdapter.java │ └── PaperUtils.java └── spigot └── pom.xml /main/src/main/java/su/nightexpress/nightcore/locale/LangContainer.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.locale; 2 | 3 | public interface LangContainer { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/ParserMode.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night; 2 | 3 | public enum ParserMode { 4 | PARSE, STRIP 5 | } 6 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/geodata/DimensionType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.geodata; 2 | 3 | public enum DimensionType { 4 | _2D, 5 | _3D 6 | } 7 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/config/DatabaseType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.config; 2 | 3 | public enum DatabaseType { 4 | 5 | MYSQL, 6 | SQLITE, 7 | } 8 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/time/TimeFormatType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.time; 2 | 3 | public enum TimeFormatType { 4 | LITERAL, DIGITAL, SECONDS 5 | } 6 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/DatabaseType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database; 2 | 3 | @Deprecated 4 | public enum DatabaseType { 5 | 6 | MYSQL, 7 | SQLITE, 8 | } 9 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/locale/message/MessageType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.locale.message; 2 | 3 | public enum MessageType { 4 | CHAT, ACTION_BAR, TITLE, SILENT, 5 | } 6 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/locale/LangDefaults.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.locale; 2 | 3 | public class LangDefaults { 4 | 5 | public static final String GAME_GUI_OK = "gui.ok"; 6 | } 7 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/language/message/OutputType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.language.message; 2 | 3 | @Deprecated 4 | public enum OutputType { 5 | CHAT, ACTION_BAR, TITLES, NONE, 6 | } 7 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/locale/LangValue.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.locale; 2 | 3 | import su.nightexpress.nightcore.config.Writeable; 4 | 5 | public interface LangValue extends Writeable { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/bossbar/NightBarFlag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.bossbar; 2 | 3 | public enum NightBarFlag { 4 | DARKEN_SCREEN, 5 | PLAY_BOSS_MUSIC, 6 | CREATE_WORLD_FOG 7 | } 8 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/base/WrappedDialogAfterAction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.base; 2 | 3 | public enum WrappedDialogAfterAction { 4 | 5 | CLOSE, 6 | NONE, 7 | WAIT_FOR_RESPONSE 8 | } 9 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/bridge/wrapper/HoverEventType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.bridge.wrapper; 2 | 3 | @Deprecated 4 | public enum HoverEventType { 5 | 6 | SHOW_TEXT, 7 | SHOW_ITEM 8 | //SHOW_ENTITY, 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/config/Writeable.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.config; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public interface Writeable { 6 | 7 | void write(@NotNull FileConfig config, @NotNull String path); 8 | } 9 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/bossbar/NightBarOverlay.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.bossbar; 2 | 3 | public enum NightBarOverlay { 4 | PROGRESS, 5 | NOTCHED_6, 6 | NOTCHED_10, 7 | NOTCHED_12, 8 | NOTCHED_20 9 | } 10 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/bossbar/NightBarColor.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.bossbar; 2 | 3 | public enum NightBarColor { 4 | PINK, 5 | BLUE, 6 | RED, 7 | GREEN, 8 | YELLOW, 9 | PURPLE, 10 | WHITE 11 | } 12 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/decorator/ColorDecorator.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.decorator; 2 | 3 | @Deprecated 4 | public interface ColorDecorator extends Decorator { 5 | 6 | // Exists just to clarify color decorators. 7 | } 8 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/query/Query.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.query; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public interface Query { 6 | 7 | @NotNull String toSQL(@NotNull String table); 8 | 9 | boolean isEmpty(); 10 | } 11 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/dialog/DialogHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.dialog; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @Deprecated 6 | public interface DialogHandler { 7 | 8 | boolean handle(@NotNull DialogInput input); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/api/PlaceholderTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @Deprecated 6 | public interface PlaceholderTag { 7 | 8 | @NotNull String getValue(); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/permission/PermissionPlugins.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.permission; 2 | 3 | public class PermissionPlugins { 4 | 5 | public static final String VAULT = "Vault"; 6 | public static final String LUCK_PERMS = "LuckPerms"; 7 | } 8 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/response/DialogClickHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.response; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public interface DialogClickHandler { 6 | 7 | void handleClick(@NotNull DialogClickResult result); 8 | } 9 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/dialog/DialogHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.dialog; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @Deprecated 6 | public interface DialogHandler { 7 | 8 | boolean onInput(@NotNull Dialog dialog, @NotNull WrappedInput input); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: nightcore 2 | main: su.nightexpress.nightcore.NightCore 3 | version: '${project.version}' 4 | description: Plugin core 5 | author: NightExpress 6 | api-version: 1.20 7 | load: STARTUP 8 | libraries: 9 | - com.zaxxer:HikariCP:6.0.0 10 | - it.unimi.dsi:fastutil-core:8.5.13 -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/bridge/wrapper/ComponentBuildable.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.bridge.wrapper; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @Deprecated 6 | public interface ComponentBuildable { 7 | 8 | @NotNull NightComponent toComponent(); 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.idea/ 2 | /pom.xml.versionsBackup 3 | /target/ 4 | /utils/target/ 5 | /utils/pom.xml.versionsBackup 6 | /spigot/target/ 7 | /spigot/pom.xml.versionsBackup 8 | /paper/target/ 9 | /paper/pom.xml.versionsBackup 10 | /main/target/ 11 | /main/pom.xml.versionsBackup 12 | /bridge/pom.xml.versionsBackup 13 | /bridge/target/ -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/input/text/WrappedMultilineOptions.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.input.text; 2 | 3 | import org.jetbrains.annotations.Nullable; 4 | 5 | public record WrappedMultilineOptions(@Nullable Integer maxLines, @Nullable Integer height) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/chat/UniversalChatEventHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.chat; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @FunctionalInterface 6 | public interface UniversalChatEventHandler { 7 | 8 | void handle(@NotNull UniversalChatEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/action/ObjectAction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.action; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @FunctionalInterface 6 | public interface ObjectAction { 7 | 8 | void execute(@NotNull ObjectActionContext context); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/placeholder/PlaceholderResolvable.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.placeholder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @FunctionalInterface 6 | public interface PlaceholderResolvable { 7 | 8 | @NotNull PlaceholderResolver placeholders(); 9 | } 10 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/input/single/WrappedSingleOptionEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.input.single; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public record WrappedSingleOptionEntry(@NotNull String id, @NotNull String display, boolean initial) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/bridge/wrapper/ClickEventType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.bridge.wrapper; 2 | 3 | @Deprecated 4 | public enum ClickEventType { 5 | 6 | OPEN_URL, 7 | OPEN_FILE, 8 | RUN_COMMAND, 9 | SUGGEST_COMMAND, 10 | CHANGE_PAGE, 11 | COPY_TO_CLIPBOARD 12 | } 13 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/entry/Entry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 5 | 6 | public interface Entry { 7 | 8 | @NotNull NightComponent toComponent(); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/geodata/GeoUtils.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.geodata; 2 | 3 | public class GeoUtils { 4 | 5 | public static int shiftToChunk(int x) { 6 | return x >> 4; 7 | } 8 | 9 | public static int shiftToCoord(int chunkX) { 10 | return chunkX << 4; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/config/ReadFunction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.config; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public interface ReadFunction { 7 | 8 | @Nullable V read(@NotNull FileConfig config, @NotNull String path, @NotNull String id); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/placeholder/PlaceholderResolver.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.placeholder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | @FunctionalInterface 7 | public interface PlaceholderResolver { 8 | 9 | @Nullable String resolve(@NotNull String key); 10 | } 11 | -------------------------------------------------------------------------------- /utils/src/main/java/su/nightexpress/nightcore/util/problem/Problem.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.problem; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public interface Problem { 6 | 7 | @NotNull String description(); 8 | 9 | record ChildReport(@NotNull String description, @NotNull ProblemReporter reporter) implements Problem {} 10 | } 11 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/adapter/DialogAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.wrap.WrappedDialog; 5 | 6 | public interface DialogAdapter { 7 | 8 | @NotNull D adaptDialog(@NotNull WrappedDialog dialog); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/node/NodeExecutor.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental.node; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.command.experimental.CommandContext; 5 | 6 | @Deprecated 7 | public interface NodeExecutor { 8 | 9 | boolean run(@NotNull CommandContext context); 10 | } 11 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/adapter/DialogBaseAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.wrap.base.WrappedDialogBase; 5 | 6 | public interface DialogBaseAdapter { 7 | 8 | @NotNull B adaptBase(@NotNull WrappedDialogBase base); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/manager/SimpeListener.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.manager; 2 | 3 | import org.bukkit.event.HandlerList; 4 | import org.bukkit.event.Listener; 5 | 6 | public interface SimpeListener extends Listener { 7 | 8 | void registerListeners(); 9 | 10 | default void unregisterListeners() { 11 | HandlerList.unregisterAll(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/adapter/DialogButtonAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.wrap.button.WrappedActionButton; 5 | 6 | public interface DialogButtonAdapter { 7 | 8 | @NotNull B adaptButton(@NotNull WrappedActionButton button); 9 | } 10 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/action/WrappedDialogAction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.action; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogActionAdapter; 5 | 6 | public interface WrappedDialogAction { 7 | 8 | @NotNull A adapt(@NotNull DialogActionAdapter adapter); 9 | } 10 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/condition/ItemStateCondition.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.condition; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.ui.inventory.viewer.ViewerContext; 5 | 6 | @FunctionalInterface 7 | public interface ItemStateCondition { 8 | 9 | boolean canSeenBy(@NotNull ViewerContext context); 10 | } 11 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/menu/item/ItemClick.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.menu.item; 2 | 3 | import org.bukkit.event.inventory.InventoryClickEvent; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.ui.menu.MenuViewer; 6 | 7 | public interface ItemClick { 8 | 9 | void onClick(@NotNull MenuViewer viewer, @NotNull InventoryClickEvent event); 10 | } 11 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/api/ContentTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.tag.decorator.Decorator; 6 | 7 | @Deprecated 8 | public interface ContentTag { 9 | 10 | @Nullable Decorator parse(@NotNull String str); 11 | } 12 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/argument/ParsedArgument.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental.argument; 2 | 3 | @Deprecated 4 | public class ParsedArgument { 5 | 6 | private final T result; 7 | 8 | public ParsedArgument(T result) { 9 | this.result = result; 10 | } 11 | 12 | public T getResult() { 13 | return result; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/menu/click/ClickAction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.menu.click; 2 | 3 | import org.bukkit.event.inventory.InventoryClickEvent; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.menu.MenuViewer; 6 | 7 | @Deprecated 8 | public interface ClickAction { 9 | 10 | void onClick(@NotNull MenuViewer viewer, @NotNull InventoryClickEvent event); 11 | } 12 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/chat/UniversalChatListenerCallback.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.chat; 2 | 3 | import org.bukkit.event.EventPriority; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.function.Supplier; 7 | 8 | public interface UniversalChatListenerCallback { 9 | 10 | void run(@NotNull EventPriority priority, @NotNull Supplier event); 11 | } 12 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/condition/ItemStateConditions.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.condition; 2 | 3 | public class ItemStateConditions { 4 | 5 | public static final ItemStateCondition NEXT_PAGE = context -> context.getViewer().canNavigateForward(); 6 | public static final ItemStateCondition PREVIOUS_PAGE = context -> context.getViewer().canNavigateBackward(); 7 | // TODO Back 8 | } 9 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/menu/data/LinkHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.menu.data; 2 | 3 | import org.bukkit.event.inventory.InventoryClickEvent; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.ui.menu.MenuViewer; 6 | 7 | public interface LinkHandler { 8 | 9 | void handle(@NotNull MenuViewer viewer, @NotNull InventoryClickEvent event, @NotNull T obj); 10 | } 11 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/NodeExecutor.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.commands.context.CommandContext; 5 | import su.nightexpress.nightcore.commands.context.ParsedArguments; 6 | 7 | public interface NodeExecutor { 8 | 9 | boolean run(@NotNull CommandContext context, @NotNull ParsedArguments arguments); 10 | } 11 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/NightCoreBootstrap.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore; 2 | 3 | import io.papermc.paper.plugin.bootstrap.BootstrapContext; 4 | import io.papermc.paper.plugin.bootstrap.PluginBootstrap; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public class NightCoreBootstrap implements PluginBootstrap { 8 | 9 | @Override 10 | public void bootstrap(@NotNull BootstrapContext context) { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/sql/query/type/ValuedQuery.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.sql.query.type; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.db.sql.column.Column; 5 | 6 | import java.util.function.Function; 7 | 8 | public interface ValuedQuery, T> { 9 | 10 | @NotNull Q setValue(@NotNull Column column, @NotNull Function function); 11 | } 12 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/item/DisplayModifier.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.item; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.ui.inventory.viewer.ViewerContext; 5 | import su.nightexpress.nightcore.util.bukkit.NightItem; 6 | 7 | @FunctionalInterface 8 | public interface DisplayModifier { 9 | 10 | void modify(@NotNull ViewerContext context, @NotNull NightItem item); 11 | } 12 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/dialog/DialogListener.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.dialog; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightCore; 5 | import su.nightexpress.nightcore.manager.AbstractListener; 6 | 7 | @Deprecated 8 | public class DialogListener extends AbstractListener { 9 | 10 | public DialogListener(@NotNull NightCore plugin) { 11 | super(plugin); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/menu/data/Filled.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.menu.data; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.ui.menu.MenuViewer; 5 | 6 | public interface Filled { 7 | 8 | @NotNull MenuFiller createFiller(@NotNull MenuViewer viewer); 9 | 10 | default void autoFill(@NotNull MenuViewer viewer) { 11 | this.createFiller(viewer).addItems(viewer); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/decorator/Decorator.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.decorator; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.text.NightAbstractComponent; 5 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 6 | 7 | @Deprecated 8 | public interface Decorator { 9 | 10 | @NotNull NightComponent decorate(@NotNull NightComponent component); 11 | } 12 | -------------------------------------------------------------------------------- /paper/src/main/java/su/nightexpress/nightcore/bridge/paper/text/PaperAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.paper.text; 2 | 3 | import net.kyori.adventure.key.Key; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.bridge.common.NightKey; 6 | 7 | public abstract class PaperAdapter { 8 | 9 | @NotNull 10 | protected Key adaptKey(@NotNull NightKey key) { 11 | return Key.key(key.namespace(), key.value()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/argument/ArgumentParser.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental.argument; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.command.experimental.CommandContext; 6 | 7 | @Deprecated 8 | public interface ArgumentParser { 9 | 10 | @Nullable T parse(@NotNull String string, @NotNull CommandContext context); 11 | } 12 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/menu/MenuSize.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.menu; 2 | 3 | @Deprecated 4 | public enum MenuSize { 5 | 6 | CHEST_9(9), 7 | CHEST_18(18), 8 | CHEST_27(27), 9 | CHEST_36(36), 10 | CHEST_45(45), 11 | CHEST_54(54) 12 | ; 13 | 14 | private final int size; 15 | 16 | MenuSize(int size) { 17 | this.size = size; 18 | } 19 | 20 | public int getSize() { 21 | return size; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/action/MenuItemAction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.action; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @FunctionalInterface 6 | public interface MenuItemAction { 7 | 8 | /** 9 | * Executes the action. 10 | * @param context The context of the action, containing information about the viewer and any bound object. 11 | */ 12 | void execute(@NotNull ActionContext context); 13 | } 14 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/action/MenuItemActions.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.action; 2 | 3 | public class MenuItemActions { 4 | 5 | public static final MenuItemAction NEXT_PAGE = context -> context.getViewer().navigateForward(); 6 | public static final MenuItemAction PREVIOUS_PAGE = context -> context.getViewer().navigateBackward(); 7 | public static final MenuItemAction CLOSE = context -> context.getViewer().closeMenu(); 8 | } 9 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/placeholder/Placeholder.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.placeholder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.function.UnaryOperator; 6 | 7 | @Deprecated 8 | public interface Placeholder { 9 | 10 | @NotNull PlaceholderMap getPlaceholders(); 11 | 12 | @NotNull 13 | default UnaryOperator replacePlaceholders() { 14 | return this.getPlaceholders().replacer(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /paper/src/main/java/su/nightexpress/nightcore/bridge/paper/PaperUtils.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.paper; 2 | 3 | import net.kyori.adventure.text.Component; 4 | import net.kyori.adventure.text.minimessage.MiniMessage; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public class PaperUtils { 8 | 9 | @NotNull 10 | public static String serializeComponent(@NotNull Component component) { 11 | return MiniMessage.miniMessage().serialize(component); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/SuggestionsProvider.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.commands.argument.ArgumentReader; 5 | import su.nightexpress.nightcore.commands.context.CommandContext; 6 | 7 | import java.util.List; 8 | 9 | public interface SuggestionsProvider { 10 | 11 | @NotNull List suggest(@NotNull ArgumentReader reader, @NotNull CommandContext context); 12 | } 13 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/impl/ResetTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.impl; 2 | 3 | import su.nightexpress.nightcore.util.text.tag.api.Tag; 4 | 5 | @Deprecated 6 | public class ResetTag extends Tag { 7 | 8 | public static final String NAME = "reset"; 9 | 10 | public ResetTag() { 11 | super(NAME, new String[]{"r"}); 12 | } 13 | 14 | @Override 15 | public boolean isCloseable() { 16 | return false; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/language/entry/LangElement.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.language.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightCorePlugin; 5 | import su.nightexpress.nightcore.config.FileConfig; 6 | 7 | @Deprecated 8 | public interface LangElement { 9 | 10 | void write(@NotNull FileConfig config); 11 | 12 | void load(@NotNull NightCorePlugin plugin); 13 | 14 | void load(@NotNull FileConfig config); 15 | } 16 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/TriFunction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util; 2 | 3 | import java.util.Objects; 4 | import java.util.function.Function; 5 | 6 | @Deprecated 7 | public interface TriFunction { 8 | 9 | R apply(T t, U u, V v); 10 | 11 | default TriFunction andThen(Function after) { 12 | Objects.requireNonNull(after); 13 | return (T t, U u, V v) -> after.apply(apply(t, u, v)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/node/DirectExecutor.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental.node; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.command.experimental.CommandContext; 5 | import su.nightexpress.nightcore.command.experimental.argument.ParsedArguments; 6 | 7 | @Deprecated 8 | public interface DirectExecutor { 9 | 10 | boolean execute(@NotNull CommandContext context, @NotNull ParsedArguments arguments); 11 | } 12 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/argument/ArgumentType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.argument; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.commands.context.CommandContextBuilder; 5 | import su.nightexpress.nightcore.commands.exceptions.CommandSyntaxException; 6 | 7 | public interface ArgumentType { 8 | 9 | @NotNull T parse(@NotNull CommandContextBuilder contextBuilder, @NotNull String string) throws CommandSyntaxException; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/TagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 6 | 7 | public interface TagHandler { 8 | 9 | void handleOpen(@NotNull EntryGroup group, @Nullable String tagContent); 10 | 11 | void handleClose(@NotNull EntryGroup group); 12 | 13 | boolean canBeClosed(); 14 | } 15 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/command/HubCommand.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.command; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightPlugin; 5 | import su.nightexpress.nightcore.commands.tree.HubNode; 6 | 7 | import java.util.List; 8 | 9 | public class HubCommand extends AbstractCommand { 10 | 11 | public HubCommand(@NotNull NightPlugin plugin, @NotNull HubNode root, @NotNull List aliases) { 12 | super(plugin, root, aliases); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/Registries.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge; 2 | 3 | import su.nightexpress.nightcore.bridge.currency.Currency; 4 | import su.nightexpress.nightcore.bridge.item.ItemAdapter; 5 | import su.nightexpress.nightcore.bridge.registry.NightRegistry; 6 | 7 | public class Registries { 8 | 9 | public static final NightRegistry CURRENCY = new NightRegistry<>(); 10 | public static final NightRegistry> ITEM_ADAPTER = new NightRegistry<>(); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/body/WrappedDialogBody.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.body; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogBodyAdapter; 5 | 6 | import java.util.function.UnaryOperator; 7 | 8 | public interface WrappedDialogBody { 9 | 10 | @NotNull D adapt(@NotNull DialogBodyAdapter adapter); 11 | 12 | @Deprecated 13 | @NotNull WrappedDialogBody replace(@NotNull UnaryOperator operator); 14 | } 15 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/type/WrappedDialogType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.type; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogTypeAdapter; 5 | 6 | import java.util.function.UnaryOperator; 7 | 8 | public interface WrappedDialogType { 9 | 10 | @NotNull T adapt(@NotNull DialogTypeAdapter factory); 11 | 12 | @Deprecated 13 | @NotNull WrappedDialogType replace(@NotNull UnaryOperator operator); 14 | } 15 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/entry/ChildEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public abstract class ChildEntry implements Entry { 6 | 7 | protected final EntryGroup parent; 8 | 9 | public ChildEntry(@NotNull EntryGroup parent) { 10 | this.parent = parent; 11 | } 12 | 13 | @NotNull 14 | public EntryGroup getParent() { 15 | return this.parent; 16 | } 17 | 18 | public abstract int textLength(); 19 | } 20 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/wrap/NightSound.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.wrap; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.entity.Player; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public interface NightSound { 8 | 9 | boolean isSilent(); 10 | 11 | void play(@NotNull Player player); 12 | 13 | void play(@NotNull Location location); 14 | 15 | @NotNull String serialize(); 16 | 17 | @NotNull String getName(); 18 | 19 | float getVolume(); 20 | 21 | float getPitch(); 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/command/LiteralCommand.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.command; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightPlugin; 5 | import su.nightexpress.nightcore.commands.tree.LiteralNode; 6 | 7 | import java.util.List; 8 | 9 | public class LiteralCommand extends AbstractCommand { 10 | 11 | public LiteralCommand(@NotNull NightPlugin plugin, @NotNull LiteralNode root, @NotNull List aliases) { 12 | super(plugin, root, aliases); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/action/WrappedDialogCommandTemplateAction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.action; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogActionAdapter; 5 | 6 | public record WrappedDialogCommandTemplateAction(@NotNull String template) implements WrappedDialogAction { 7 | 8 | @Override 9 | @NotNull 10 | public A adapt(@NotNull DialogActionAdapter adapter) { 11 | return adapter.adaptAction(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/core/CoreLogger.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.core; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.Engine; 5 | 6 | @Deprecated 7 | public class CoreLogger { 8 | 9 | public static void info(@NotNull String text) { 10 | Engine.core().info(text); 11 | } 12 | 13 | public static void warn(@NotNull String text) { 14 | Engine.core().warn(text); 15 | } 16 | 17 | public static void error(@NotNull String text) { 18 | Engine.core().error(text); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/chat/UniversalChatRenderer.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.chat; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 8 | 9 | public interface UniversalChatRenderer { 10 | 11 | @NotNull NightComponent render(@NotNull Player source, @NotNull String sourceDisplayName, @NotNull String message, @Nullable CommandSender viewer); 12 | } 13 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/response/DialogResponseHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.response; 2 | 3 | import org.bukkit.NamespacedKey; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import su.nightexpress.nightcore.bridge.common.NightNbtHolder; 7 | import su.nightexpress.nightcore.bridge.dialog.DialogViewer; 8 | 9 | public interface DialogResponseHandler { 10 | 11 | void handle(@NotNull DialogViewer viewer, @NotNull NamespacedKey identifier, @Nullable NightNbtHolder nbtHolder); 12 | } 13 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/DialogViewer.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import su.nightexpress.nightcore.bridge.dialog.wrap.WrappedDialog; 7 | 8 | public interface DialogViewer { 9 | 10 | void close(); 11 | 12 | void closeFully(); 13 | 14 | void callback(); 15 | 16 | @NotNull Player getPlayer(); 17 | 18 | @NotNull WrappedDialog getDialog(); 19 | 20 | @Nullable Runnable getCallback(); 21 | } 22 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/input/WrappedDialogInput.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.input; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogInputAdapter; 5 | 6 | import java.util.function.UnaryOperator; 7 | 8 | public interface WrappedDialogInput { 9 | 10 | @NotNull String key(); 11 | 12 | @NotNull I adapt(@NotNull DialogInputAdapter adapter); 13 | 14 | @Deprecated 15 | @NotNull WrappedDialogInput replace(@NotNull UnaryOperator operator); 16 | } 17 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/context/ParsedArgument.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.context; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public class ParsedArgument { 6 | 7 | private final T result; 8 | private final int cursor; 9 | 10 | public ParsedArgument(@NotNull T result, int cursor) { 11 | this.result = result; 12 | this.cursor = cursor; 13 | } 14 | 15 | public T getResult() { 16 | return result; 17 | } 18 | 19 | public int getCursor() { 20 | return this.cursor; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/sql/util/WhereOperator.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.sql.util; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public enum WhereOperator { 6 | 7 | GREATER(">"), 8 | GREATER_OR_EQUAL(">="), 9 | SMALLER("<"), 10 | SMALLER_OR_EQUAL("<="), 11 | EQUAL("="), 12 | NOT_EQUAL("!="); 13 | 14 | private final String literal; 15 | 16 | WhereOperator(@NotNull String literal) { 17 | this.literal = literal; 18 | } 19 | 20 | @NotNull 21 | public String getLiteral() { 22 | return literal; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/DialogKeys.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog; 2 | 3 | import org.bukkit.NamespacedKey; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public class DialogKeys { 7 | 8 | public static final String NAMESPACE = "nightcore_dialogs"; 9 | 10 | public static boolean isRightNamespace(@NotNull NamespacedKey key) { 11 | return isRightNamespace(key.getNamespace()); 12 | } 13 | 14 | public static boolean isRightNamespace(@NotNull String namespace) { 15 | return namespace.equalsIgnoreCase(NAMESPACE); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/item/AdaptedItem.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.item; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import java.util.Optional; 8 | 9 | public interface AdaptedItem { 10 | 11 | @NotNull ItemAdapter getAdapter(); 12 | 13 | @Nullable ItemStack getItemStack(); 14 | 15 | @NotNull Optional itemStack(); 16 | 17 | boolean isSimilar(@NotNull ItemStack other); 18 | 19 | boolean isValid(); 20 | 21 | int getAmount(); 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/ServerCommand.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental; 2 | 3 | import org.bukkit.command.TabExecutor; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.command.experimental.node.CommandNode; 6 | import su.nightexpress.nightcore.command.impl.WrappedCommand; 7 | 8 | @Deprecated 9 | public interface ServerCommand extends TabExecutor { 10 | 11 | boolean register(); 12 | 13 | boolean unregister(); 14 | 15 | @NotNull CommandNode getNode(); 16 | 17 | @NotNull WrappedCommand getBackend(); 18 | } 19 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/manager/AbstractListener.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.manager; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightCorePlugin; 5 | 6 | public abstract class AbstractListener

extends AbstractMenu

{ 10 | 11 | public NormalMenu(@NotNull P plugin, @NotNull MenuType menuType, @NotNull String title) { 12 | super(plugin, menuType, title); 13 | } 14 | 15 | public boolean open(@NotNull Player player) { 16 | return this.open(player, viewer -> {}); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/decorator/BaseColorDecorator.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.decorator; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 5 | 6 | import java.awt.*; 7 | 8 | @Deprecated 9 | public class BaseColorDecorator implements ColorDecorator { 10 | 11 | private final Color color; 12 | 13 | public BaseColorDecorator(@NotNull Color color) { 14 | this.color = color; 15 | } 16 | 17 | @Override 18 | @NotNull 19 | public NightComponent decorate(@NotNull NightComponent component) { 20 | return component.color(this.color); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/core/tag/ColorCode.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.core.tag; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.text.night.tag.handler.NamedColorTagHandler; 5 | 6 | import java.awt.*; 7 | 8 | public record ColorCode(@NotNull String name, @NotNull Color color) { 9 | 10 | @NotNull 11 | public NamedColorTagHandler createHandler() { 12 | return new NamedColorTagHandler(this.name, this.color); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "ColorCode{" + 18 | "name='" + name + '\'' + 19 | ", color=" + color + 20 | '}'; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/adapter/DialogBodyAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.wrap.body.WrappedDialogBody; 5 | import su.nightexpress.nightcore.bridge.dialog.wrap.body.WrappedItemDialogBody; 6 | import su.nightexpress.nightcore.bridge.dialog.wrap.body.WrappedPlainMessageDialogBody; 7 | 8 | public interface DialogBodyAdapter { 9 | 10 | @NotNull D adaptBody(@NotNull WrappedDialogBody body); 11 | 12 | @NotNull D adaptBody(@NotNull WrappedPlainMessageDialogBody body); 13 | 14 | @NotNull D adaptBody(@NotNull WrappedItemDialogBody body); 15 | } 16 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/language/entry/LangEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.language.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @Deprecated 6 | public abstract class LangEntry implements LangElement { 7 | 8 | protected final String path; 9 | protected final String defaultText; 10 | 11 | public LangEntry(@NotNull String path, @NotNull String defaultText) { 12 | this.path = path; 13 | this.defaultText = defaultText; 14 | } 15 | 16 | @NotNull 17 | public String getPath() { 18 | return this.path; 19 | } 20 | 21 | @NotNull 22 | public String getDefaultText() { 23 | return this.defaultText; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/decorator/FontDecorator.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.decorator; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.common.NightKey; 5 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 6 | 7 | @Deprecated 8 | public class FontDecorator implements Decorator { 9 | 10 | private final String font; 11 | 12 | public FontDecorator(@NotNull String font) { 13 | this.font = font; 14 | } 15 | 16 | @Override 17 | @NotNull 18 | public NightComponent decorate(@NotNull NightComponent component) { 19 | return component.font(NightKey.key(this.font)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/adapter/DialogTypeAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.wrap.type.*; 5 | 6 | public interface DialogTypeAdapter { 7 | 8 | @NotNull T adaptType(@NotNull WrappedDialogType type); 9 | 10 | @NotNull T adaptType(@NotNull WrappedConfirmationType type); 11 | 12 | @NotNull T adaptType(@NotNull WrappedDialogListType type); 13 | 14 | @NotNull T adaptType(@NotNull WrappedMultiActionType type); 15 | 16 | @NotNull T adaptType(@NotNull WrappedNoticeType type); 17 | 18 | @NotNull T adaptType(@NotNull WrappedServerLinksType type); 19 | } 20 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/ImprovedCommands.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightCorePlugin; 5 | import su.nightexpress.nightcore.command.experimental.node.ChainedNode; 6 | 7 | @Deprecated 8 | public interface ImprovedCommands extends NightCorePlugin { 9 | 10 | @NotNull 11 | @Deprecated 12 | default ServerCommand getRootCommand() { 13 | return this.getCommandManager().getRootCommand(); 14 | } 15 | 16 | @NotNull 17 | @Deprecated 18 | default ChainedNode getRootNode() { 19 | return this.getCommandManager().getRootCommand().getNode(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/query/TypedValue.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.query; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.function.Function; 6 | 7 | public class TypedValue { 8 | 9 | private final String sql; 10 | private final Function extractor; 11 | 12 | public TypedValue(@NotNull String sql, @NotNull Function extractor) { 13 | this.sql = sql; 14 | this.extractor = extractor; 15 | } 16 | 17 | @NotNull 18 | public String toSQL() { 19 | return this.sql; 20 | } 21 | 22 | @NotNull 23 | public String extract(T entity) { 24 | return this.extractor.apply(entity); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/menu/data/ConfigBased.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.menu.data; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.config.FileConfig; 5 | import su.nightexpress.nightcore.ui.menu.Menu; 6 | 7 | public interface ConfigBased extends Menu { 8 | 9 | default void load(@NotNull FileConfig config) { 10 | MenuLoader loader = new MenuLoader(this, config); 11 | loader.loadSettings(); 12 | this.loadConfiguration(config, loader); 13 | loader.loadItems(); 14 | loader.loadComments(); 15 | config.saveChanges(); 16 | } 17 | 18 | void loadConfiguration(@NotNull FileConfig config, @NotNull MenuLoader loader); 19 | } 20 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/text/adapter/ObjectContentsAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.text.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.text.contents.NightObjectContents; 5 | import su.nightexpress.nightcore.bridge.text.contents.NightPlayerHeadObjectContents; 6 | import su.nightexpress.nightcore.bridge.text.contents.NightSpriteObjectContents; 7 | 8 | public interface ObjectContentsAdapter { 9 | 10 | @NotNull C adaptContents(@NotNull NightObjectContents contents); 11 | 12 | @NotNull C adaptContents(@NotNull NightSpriteObjectContents contents); 13 | 14 | @NotNull C adaptContents(@NotNull NightPlayerHeadObjectContents contents); 15 | } 16 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/action/ObjectActionContext.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.action; 2 | 3 | import org.bukkit.event.inventory.InventoryClickEvent; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.ui.inventory.viewer.MenuViewer; 6 | 7 | public class ObjectActionContext extends ActionContext { 8 | 9 | private final T object; 10 | 11 | public ObjectActionContext(@NotNull MenuViewer viewer, @NotNull T object, @NotNull InventoryClickEvent event) { 12 | super(viewer, object, event); 13 | this.object = object; 14 | } 15 | 16 | @NotNull 17 | @Override 18 | public T getObject() { 19 | return this.object; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/ResetTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.bridge.text.NightStyle; 6 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 7 | 8 | public class ResetTagHandler extends ClassicTagHandler { 9 | 10 | @Override 11 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 12 | group.setStyle(NightStyle.EMPTY); 13 | group.setStyleLocked(true); 14 | } 15 | 16 | @Override 17 | protected void onHandleClose(@NotNull EntryGroup group) { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/builder/SimpleFlagBuilder.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental.builder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.command.experimental.flag.SimpleFlag; 5 | 6 | @Deprecated 7 | public class SimpleFlagBuilder extends FlagBuilder { 8 | 9 | public SimpleFlagBuilder(@NotNull String name) { 10 | super(name); 11 | } 12 | 13 | @Override 14 | @NotNull 15 | protected SimpleFlagBuilder getThis() { 16 | return this; 17 | } 18 | 19 | @Override 20 | @NotNull 21 | public SimpleFlag build() { 22 | return new SimpleFlag(this.name, this.permission); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/random/WeightedItem.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.random; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public class WeightedItem { 6 | 7 | private final T item; 8 | private final double weight; 9 | 10 | public WeightedItem(@NotNull T item, double weight) { 11 | this.item = item; 12 | this.weight = weight; 13 | } 14 | 15 | @NotNull 16 | public static WeightedItem of(@NotNull T item, double weight) { 17 | return new WeightedItem<>(item, weight); 18 | } 19 | 20 | @NotNull 21 | public T getItem() { 22 | return this.item; 23 | } 24 | 25 | public double getWeight() { 26 | return this.weight; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/entry/KeybindEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 5 | 6 | public class KeybindEntry extends ChildEntry { 7 | 8 | private final String key; 9 | 10 | public KeybindEntry(@NotNull EntryGroup parent, @NotNull String key) { 11 | super(parent); 12 | this.key = key; 13 | } 14 | 15 | @Override 16 | public int textLength() { 17 | return 1; 18 | } 19 | 20 | @Override 21 | @NotNull 22 | public NightComponent toComponent() { 23 | return NightComponent.keybind(this.key, this.parent.style()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/sql/query/type/AbstractQuery.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.sql.query.type; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.db.sql.util.SQLUtils; 5 | 6 | import java.sql.PreparedStatement; 7 | import java.sql.SQLException; 8 | 9 | public abstract class AbstractQuery { 10 | 11 | @NotNull 12 | public String createSQL(@NotNull String table) { 13 | return this.buildSQL(SQLUtils.escape(table)); 14 | } 15 | 16 | public abstract boolean isEmpty(); 17 | 18 | public abstract void onExecute(@NotNull PreparedStatement statement, @NotNull T entity) throws SQLException; 19 | 20 | @NotNull 21 | protected abstract String buildSQL(@NotNull String table); 22 | } 23 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/item/ItemAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.item; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import java.util.Optional; 8 | 9 | public interface ItemAdapter { 10 | 11 | @NotNull String getName(); 12 | 13 | boolean canHandle(@NotNull ItemStack itemStack); 14 | 15 | boolean canHandle(@NotNull T data); 16 | 17 | @NotNull Optional adapt(@NotNull ItemStack itemStack); 18 | 19 | @Nullable ItemStack toItemStack(@NotNull T data); 20 | 21 | @Nullable T fromItemStack(@NotNull ItemStack itemStack); 22 | 23 | boolean isVanilla(); 24 | 25 | int getWeight(); 26 | } 27 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/wrapper/TagWrapper.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.wrapper; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public interface TagWrapper { 6 | 7 | @NotNull 8 | static SimpleTagWrapper simple(@NotNull String tag) { 9 | return new SimpleTagWrapper(tag, new String[0]); 10 | } 11 | 12 | @NotNull 13 | static SimpleTagWrapper withArguments(@NotNull String tag, @NotNull String... arguments) { 14 | return new SimpleTagWrapper(tag, arguments); 15 | } 16 | 17 | @NotNull String wrap(@NotNull String string); 18 | 19 | @NotNull 20 | default TagWrapper and(@NotNull TagWrapper other) { 21 | return str -> this.wrap(other.wrap(str)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/api/SimpleTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @Deprecated 6 | public class SimpleTag extends Tag { 7 | 8 | public SimpleTag(@NotNull String name) { 9 | super(name); 10 | } 11 | 12 | public SimpleTag(@NotNull String name, @NotNull String[] aliases) { 13 | super(name, aliases); 14 | } 15 | 16 | @NotNull 17 | @Deprecated 18 | public String enclose(@NotNull String text) { 19 | return this.wrap(text);//this.getBracketsName() + text + this.getClosingName(); 20 | } 21 | 22 | @NotNull 23 | public String wrap(@NotNull String text) { 24 | return this.getBracketsName() + text + this.getClosingName(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/sql/SQLValue.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database.sql; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @Deprecated 6 | public class SQLValue { 7 | 8 | private final SQLColumn column; 9 | private final String value; 10 | 11 | public SQLValue(@NotNull SQLColumn column, @NotNull String value) { 12 | this.column = column; 13 | this.value = value; 14 | } 15 | 16 | @NotNull 17 | public static SQLValue of(@NotNull SQLColumn column, @NotNull String value) { 18 | return new SQLValue(column, value); 19 | } 20 | 21 | @NotNull 22 | public SQLColumn getColumn() { 23 | return column; 24 | } 25 | 26 | @NotNull 27 | public String getValue() { 28 | return value; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/manager/ConfigBacked.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.manager; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.config.FileConfig; 5 | 6 | public interface ConfigBacked extends FileBacked { 7 | 8 | @NotNull 9 | @Deprecated 10 | default FileConfig getConfig() { 11 | return this.loadConfig(); 12 | } 13 | 14 | /** 15 | * Parses the YAML configuration from the object's file. 16 | * The config is not cached and is being loaded/parsed every time this method called. 17 | * @return A "fresh" FileConfig for the object's file. 18 | * @see FileBacked#getPath() 19 | */ 20 | @NotNull 21 | default FileConfig loadConfig() { 22 | return FileConfig.load(this.getPath()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/locale/message/impl/SilentMessage.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.locale.message.impl; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.locale.message.LangMessage; 6 | import su.nightexpress.nightcore.locale.message.MessageData; 7 | 8 | import java.util.Collection; 9 | 10 | public class SilentMessage extends LangMessage { 11 | 12 | public SilentMessage(@NotNull String text, @NotNull MessageData data) { 13 | super(text, data); 14 | } 15 | 16 | @Override 17 | public boolean isSilent() { 18 | return true; 19 | } 20 | 21 | @Override 22 | protected void send(@NotNull Collection receivers, @NotNull String text) { 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/FontTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.bridge.common.NightKey; 6 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 7 | 8 | public class FontTagHandler extends ClassicTagHandler { 9 | 10 | @Override 11 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 12 | if (tagContent == null) return; 13 | 14 | NightKey font = NightKey.key(tagContent); 15 | group.setStyle(style -> style.font(font)); 16 | } 17 | 18 | @Override 19 | protected void onHandleClose(@NotNull EntryGroup group) { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/locale/LangElement.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.locale; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightPlugin; 5 | import su.nightexpress.nightcore.config.FileConfig; 6 | 7 | public interface LangElement { 8 | 9 | @Deprecated 10 | default void load(@NotNull NightPlugin plugin, @NotNull FileConfig config, @NotNull String langCode) { 11 | this.load(plugin, config); 12 | } 13 | 14 | void load(@NotNull NightPlugin plugin, @NotNull FileConfig config/*, @NotNull String langCode*/); 15 | 16 | //boolean isSupportedLocale(@NotNull String locale); 17 | 18 | @NotNull String getPath(); 19 | 20 | //@NotNull Set getSupportedLocales(); 21 | 22 | @NotNull LangValue getDefaultValue(/*@NotNull String langCode*/); 23 | } 24 | -------------------------------------------------------------------------------- /utils/src/main/java/su/nightexpress/nightcore/util/problem/ProblemReporter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.problem; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.List; 6 | import java.util.logging.Logger; 7 | 8 | public interface ProblemReporter { 9 | 10 | @NotNull String getSubject(); 11 | 12 | @NotNull String getPath(); 13 | 14 | @NotNull List getProblems(); 15 | 16 | @NotNull String getReport(); 17 | 18 | List getChildren(); 19 | 20 | boolean isEmpty(); 21 | 22 | void print(@NotNull Logger logger); 23 | 24 | void report(@NotNull Problem problem); 25 | 26 | void report(@NotNull String problem); 27 | 28 | void children(@NotNull String description, @NotNull ProblemReporter reporter); 29 | 30 | int countProblems(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/action/ActionContext.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.action; 2 | 3 | import org.bukkit.event.inventory.InventoryClickEvent; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import su.nightexpress.nightcore.ui.inventory.viewer.MenuViewer; 7 | import su.nightexpress.nightcore.ui.inventory.viewer.ViewerContext; 8 | 9 | public class ActionContext extends ViewerContext { 10 | 11 | private final InventoryClickEvent event; 12 | 13 | public ActionContext(@NotNull MenuViewer viewer, @Nullable Object object, @NotNull InventoryClickEvent event) { 14 | super(viewer, object); 15 | this.event = event; 16 | } 17 | 18 | @NotNull 19 | public InventoryClickEvent getEvent() { 20 | return this.event; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/InsertionTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 6 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 7 | 8 | public class InsertionTagHandler extends ClassicTagHandler { 9 | 10 | @Override 11 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 12 | if (tagContent == null) return; 13 | 14 | String insetion = ParserUtils.unquoted(tagContent); 15 | group.setStyle(style -> style.insertion(insetion)); 16 | } 17 | 18 | @Override 19 | protected void onHandleClose(@NotNull EntryGroup group) { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/manager/SimpleManager.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.manager; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightCorePlugin; 5 | 6 | public abstract class SimpleManager

{ 7 | 8 | protected final P plugin; 9 | 10 | public SimpleManager(@NotNull P plugin) { 11 | this.plugin = plugin; 12 | } 13 | 14 | @NotNull 15 | public P plugin() { 16 | return this.plugin; 17 | } 18 | 19 | public void setup() { 20 | this.onLoad(); 21 | } 22 | 23 | public void shutdown() { 24 | this.onShutdown(); 25 | } 26 | 27 | public void reload() { 28 | this.shutdown(); 29 | this.setup(); 30 | } 31 | 32 | protected abstract void onLoad(); 33 | 34 | protected abstract void onShutdown(); 35 | } 36 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/placeholder/PlaceholderEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.placeholder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.function.Function; 6 | 7 | public class PlaceholderEntry { 8 | 9 | private final String key; 10 | private final Function function; 11 | 12 | public PlaceholderEntry(@NotNull String key, @NotNull Function function) { 13 | this.key = key; 14 | this.function = function; 15 | } 16 | 17 | @NotNull 18 | public String get(@NotNull T source) { 19 | return this.function.apply(source); 20 | } 21 | 22 | @NotNull 23 | public String getKey() { 24 | return this.key; 25 | } 26 | 27 | @NotNull 28 | public Function getFunction() { 29 | return this.function; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/type/WrappedNoticeType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.type; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogTypeAdapter; 5 | import su.nightexpress.nightcore.bridge.dialog.wrap.button.WrappedActionButton; 6 | 7 | import java.util.function.UnaryOperator; 8 | 9 | public record WrappedNoticeType(@NotNull WrappedActionButton action) implements WrappedDialogType { 10 | 11 | @Override 12 | @NotNull 13 | public T adapt(@NotNull DialogTypeAdapter factory) { 14 | return factory.adaptType(this); 15 | } 16 | 17 | @Override 18 | @NotNull 19 | public WrappedNoticeType replace(@NotNull UnaryOperator operator) { 20 | return new WrappedNoticeType(this.action.replace(operator)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/argument/type/PlayerNameArgumentType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.argument.type; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.commands.argument.ArgumentReader; 6 | import su.nightexpress.nightcore.commands.context.CommandContext; 7 | import su.nightexpress.nightcore.util.Players; 8 | 9 | import java.util.List; 10 | 11 | public class PlayerNameArgumentType extends StringArgumentType { 12 | 13 | public PlayerNameArgumentType() { 14 | super(false); 15 | } 16 | 17 | @Override 18 | @NotNull 19 | public List suggest(@NotNull ArgumentReader reader, @NotNull CommandContext context) { 20 | return context.getSender() instanceof Player player ? Players.playerNames(player) : Players.playerNames(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/item/ItemPlugins.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.item; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.Lists; 5 | 6 | import java.util.List; 7 | 8 | public class ItemPlugins { 9 | 10 | public static final String EXECUTABLE_ITEMS = "ExecutableItems"; 11 | public static final String EXCELLENT_CRATES = "ExcellentCrates"; 12 | public static final String ITEMS_ADDER = "ItemsAdder"; 13 | public static final String MMOITEMS = "MMOItems"; 14 | public static final String NEXO = "Nexo"; 15 | public static final String ORAXEN = "Oraxen"; 16 | 17 | @NotNull 18 | public static List values() { 19 | return Lists.newList(EXCELLENT_CRATES, EXECUTABLE_ITEMS, ITEMS_ADDER, MMOITEMS, NEXO, ORAXEN); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/chat/UniversalChatEvent.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.chat; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | import org.jetbrains.annotations.NotNull; 6 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 7 | 8 | import java.util.Set; 9 | import java.util.function.Consumer; 10 | 11 | public interface UniversalChatEvent { 12 | 13 | boolean isCancelled(); 14 | 15 | void setCancelled(boolean cancelled); 16 | 17 | @NotNull Player getPlayer(); 18 | 19 | @NotNull Set viewers(); 20 | 21 | void editViewers(@NotNull Consumer> consumer); 22 | 23 | void renderer(@NotNull UniversalChatRenderer renderer); 24 | 25 | @NotNull String message(); 26 | 27 | void message(@NotNull NightComponent component); 28 | } 29 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/text/NightTextDecoration.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.text; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public enum NightTextDecoration { 7 | 8 | OBFUSCATED, 9 | BOLD, 10 | STRIKETHROUGH, 11 | UNDERLINED, 12 | ITALIC; 13 | 14 | public enum State { 15 | 16 | NOT_SET, 17 | FALSE, 18 | TRUE; 19 | 20 | public boolean bool() { 21 | return this == TRUE; 22 | } 23 | 24 | @NotNull 25 | public static State byBoolean(boolean flag) { 26 | return flag ? TRUE : FALSE; 27 | } 28 | 29 | @NotNull 30 | public static State byBoolean(@Nullable Boolean flag) { 31 | return flag == null ? NOT_SET : byBoolean(flag.booleanValue()); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/wrap/NightProfile.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.wrap; 2 | 3 | import org.bukkit.inventory.meta.SkullMeta; 4 | import org.bukkit.profile.PlayerTextures; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import java.util.Optional; 9 | import java.util.UUID; 10 | import java.util.concurrent.CompletableFuture; 11 | 12 | public interface NightProfile { 13 | 14 | void apply(@NotNull SkullMeta meta); 15 | 16 | @Nullable UUID getId(); 17 | 18 | @NotNull Optional id(); 19 | 20 | @Nullable String getName(); 21 | 22 | @NotNull Optional name(); 23 | 24 | @NotNull PlayerTextures getTextures(); 25 | 26 | void setTextures(@Nullable PlayerTextures textures); 27 | 28 | boolean isComplete(); 29 | 30 | @NotNull CompletableFuture update(); 31 | } 32 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/sql/query/QueryValue.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.sql.query; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.function.Function; 6 | 7 | public class QueryValue { 8 | 9 | private final String sqlPart; 10 | private final Function statementPart; 11 | 12 | public QueryValue(String sqlPart, Function statementPart) { 13 | this.sqlPart = sqlPart; 14 | this.statementPart = statementPart; 15 | } 16 | 17 | @NotNull 18 | public String getSQLPart() { 19 | return this.sqlPart; 20 | } 21 | 22 | @NotNull 23 | public String getStatementPart(T entity) { 24 | return this.statementPart.apply(entity); 25 | } 26 | 27 | @NotNull 28 | public Function getStatementPart() { 29 | return this.statementPart; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/sql/column/ColumnType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database.sql.column; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | @Deprecated 6 | public class ColumnType { 7 | 8 | public static final ColumnType INTEGER = new ColumnType(ColumnFormer.INTEGER); 9 | public static final ColumnType DOUBLE = new ColumnType(ColumnFormer.DOUBLE); 10 | public static final ColumnType LONG = new ColumnType(ColumnFormer.LONG); 11 | public static final ColumnType BOOLEAN = new ColumnType(ColumnFormer.BOOLEAN); 12 | public static final ColumnType STRING = new ColumnType(ColumnFormer.STRING); 13 | 14 | private final ColumnFormer former; 15 | 16 | public ColumnType(@NotNull ColumnFormer former) { 17 | this.former = former; 18 | } 19 | 20 | @NotNull 21 | public ColumnFormer getFormer() { 22 | return former; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/adapter/DialogActionAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.wrap.action.WrappedDialogAction; 5 | import su.nightexpress.nightcore.bridge.dialog.wrap.action.WrappedDialogCommandTemplateAction; 6 | import su.nightexpress.nightcore.bridge.dialog.wrap.action.WrappedDialogCustomAction; 7 | import su.nightexpress.nightcore.bridge.dialog.wrap.action.WrappedDialogStaticAction; 8 | 9 | public interface DialogActionAdapter { 10 | 11 | @NotNull A adaptAction(@NotNull WrappedDialogAction action); 12 | 13 | @NotNull A adaptAction(@NotNull WrappedDialogStaticAction action); 14 | 15 | @NotNull A adaptAction(@NotNull WrappedDialogCustomAction action); 16 | 17 | @NotNull A adaptAction(@NotNull WrappedDialogCommandTemplateAction action); 18 | } 19 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/PlaceholderTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 6 | 7 | public class PlaceholderTagHandler extends ClassicTagHandler { 8 | 9 | private final String value; 10 | 11 | public PlaceholderTagHandler(@NotNull String value) { 12 | this.value = value; 13 | } 14 | 15 | @Override 16 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 17 | group.appendTextEntry(this.value); 18 | } 19 | 20 | @Override 21 | protected void onHandleClose(@NotNull EntryGroup group) { 22 | 23 | } 24 | 25 | @Override 26 | public boolean canBeClosed() { 27 | return false; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/sql/util/SQLUtils.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.sql.util; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.db.sql.column.Column; 5 | 6 | public class SQLUtils { 7 | 8 | @NotNull 9 | public static String escape(@NotNull String string) { 10 | if (string.isBlank()) return string; 11 | if (string.charAt(0) == '`') return string; 12 | 13 | return "`" + string + "`"; 14 | } 15 | 16 | @NotNull 17 | public static String forWhere(@NotNull Column column, @NotNull WhereOperator operator) { 18 | return column.getNameEscaped() + " " + operator.getLiteral() + " ?"; 19 | } 20 | 21 | @NotNull 22 | public static String forWhereLowercase(@NotNull Column column, @NotNull WhereOperator operator) { 23 | return column.getNameLowercase() + " " + operator.getLiteral() + " ?"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/entry/PlayerHeadEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.text.contents.NightPlayerHeadObjectContents; 5 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 6 | 7 | public class PlayerHeadEntry extends ChildEntry { 8 | 9 | private final NightPlayerHeadObjectContents contents; 10 | 11 | public PlayerHeadEntry(@NotNull EntryGroup parent, @NotNull NightPlayerHeadObjectContents contents) { 12 | super(parent); 13 | this.contents = contents; 14 | } 15 | 16 | @Override 17 | public int textLength() { 18 | return 1; 19 | } 20 | 21 | @Override 22 | @NotNull 23 | public NightComponent toComponent() { 24 | return NightComponent.object(this.parent.style(), this.contents); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/TagContent.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public class TagContent { 7 | 8 | private final String first; 9 | private final String second; 10 | 11 | public TagContent(@NotNull String first, @Nullable String second) { 12 | this.first = first; 13 | this.second = second; 14 | } 15 | 16 | public boolean hasBoth() { 17 | return this.second != null; 18 | } 19 | 20 | @NotNull 21 | public String first() { 22 | return this.first; 23 | } 24 | 25 | public String second() { 26 | return this.second; 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "TagContent{" + "first='" + first + '\'' + ", second='" + second + '\'' + '}'; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/KeybindTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 6 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 7 | 8 | public class KeybindTagHandler extends ClassicTagHandler { 9 | 10 | @Override 11 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 12 | if (tagContent == null) return; 13 | 14 | String key = ParserUtils.unquoted(tagContent); 15 | group.appendKeybindEntry(key); 16 | } 17 | 18 | @Override 19 | protected void onHandleClose(@NotNull EntryGroup group) { 20 | 21 | } 22 | 23 | @Override 24 | public boolean canBeClosed() { 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/ColorTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 6 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 7 | 8 | import java.awt.*; 9 | 10 | public class ColorTagHandler extends ClassicTagHandler { 11 | 12 | @Override 13 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 14 | if (tagContent == null) return; 15 | 16 | Color color = ParserUtils.colorFromSchemeOrHex(tagContent); 17 | if (color == null) return; 18 | 19 | group.setStyle(nightStyle -> nightStyle.color(color)); 20 | } 21 | 22 | @Override 23 | protected void onHandleClose(@NotNull EntryGroup group) { 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/sql/SQLUtils.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database.sql; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.db.sql.util.WhereOperator; 5 | 6 | @Deprecated 7 | public class SQLUtils { 8 | 9 | @NotNull 10 | public static String escape(@NotNull String string) { 11 | if (string.isBlank()) return string; 12 | if (string.charAt(0) == '`') return string; 13 | 14 | return "`" + string + "`"; 15 | } 16 | 17 | @NotNull 18 | public static String forWhere(@NotNull SQLColumn column, @NotNull WhereOperator operator) { 19 | return column.getNameEscaped() + " " + operator.getLiteral() + " ?"; 20 | } 21 | 22 | @NotNull 23 | public static String forWhereLowercase(@NotNull SQLColumn column, @NotNull WhereOperator operator) { 24 | return column.getNameLowercase() + " " + operator.getLiteral() + " ?"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/impl/FontTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.tag.TagUtils; 6 | import su.nightexpress.nightcore.util.text.tag.api.ContentTag; 7 | import su.nightexpress.nightcore.util.text.tag.api.Tag; 8 | import su.nightexpress.nightcore.util.text.tag.decorator.FontDecorator; 9 | 10 | @Deprecated 11 | public class FontTag extends Tag implements ContentTag { 12 | 13 | public FontTag() { 14 | super("font"); 15 | } 16 | 17 | @Override 18 | @Nullable 19 | public FontDecorator parse(@NotNull String str) { 20 | return new FontDecorator(str); 21 | } 22 | 23 | @NotNull 24 | public String wrap(@NotNull String text, @NotNull String fontName) { 25 | return TagUtils.wrapContent(this, text, fontName); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/connection/impl/SQLiteConnector.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.connection.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightPlugin; 5 | import su.nightexpress.nightcore.db.config.DatabaseConfig; 6 | import su.nightexpress.nightcore.db.connection.AbstractConnector; 7 | 8 | public class SQLiteConnector extends AbstractConnector { 9 | 10 | public SQLiteConnector(@NotNull NightPlugin plugin, @NotNull DatabaseConfig config) { 11 | super(plugin, config); 12 | } 13 | 14 | @Override 15 | protected String getURL(@NotNull DatabaseConfig config) { 16 | String filePath = plugin.getDataFolder().getAbsolutePath() + "/" + config.getFilename(); 17 | return "jdbc:sqlite:" + filePath; 18 | } 19 | 20 | @Override 21 | protected void setupConfig(@NotNull DatabaseConfig config) { 22 | this.config.setMaximumPoolSize(1); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/type/WrappedConfirmationType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.type; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogTypeAdapter; 5 | import su.nightexpress.nightcore.bridge.dialog.wrap.button.WrappedActionButton; 6 | 7 | import java.util.function.UnaryOperator; 8 | 9 | public record WrappedConfirmationType(@NotNull WrappedActionButton yesButton, @NotNull WrappedActionButton noButton) implements WrappedDialogType { 10 | 11 | @Override 12 | @NotNull 13 | public T adapt(@NotNull DialogTypeAdapter factory) { 14 | return factory.adaptType(this); 15 | } 16 | 17 | @Override 18 | @NotNull 19 | public WrappedConfirmationType replace(@NotNull UnaryOperator operator) { 20 | return new WrappedConfirmationType(this.yesButton.replace(operator), this.noButton.replace(operator)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/connection/SQLiteConnector.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database.connection; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightCorePlugin; 5 | import su.nightexpress.nightcore.database.AbstractConnector; 6 | import su.nightexpress.nightcore.database.DatabaseConfig; 7 | 8 | @Deprecated 9 | public class SQLiteConnector extends AbstractConnector { 10 | 11 | public SQLiteConnector(@NotNull NightCorePlugin plugin, @NotNull DatabaseConfig config) { 12 | super(plugin, config); 13 | } 14 | 15 | @Override 16 | protected String getURL(@NotNull DatabaseConfig config) { 17 | String filePath = plugin.getDataFolder().getAbsolutePath() + "/" + config.getFilename(); 18 | return "jdbc:sqlite:" + filePath; 19 | } 20 | 21 | @Override 22 | protected void setupConfig(@NotNull DatabaseConfig config) { 23 | this.config.setMaximumPoolSize(1); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/serialize/ItemStackSerializer.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database.serialize; 2 | 3 | import com.google.gson.*; 4 | import org.bukkit.inventory.ItemStack; 5 | import su.nightexpress.nightcore.util.ItemNbt; 6 | 7 | import java.lang.reflect.Type; 8 | 9 | @Deprecated 10 | public class ItemStackSerializer implements JsonSerializer, JsonDeserializer { 11 | 12 | @Override 13 | public JsonElement serialize(ItemStack item, Type type, JsonSerializationContext context) { 14 | JsonObject object = new JsonObject(); 15 | object.addProperty("data64", ItemNbt.compress(item)); 16 | return object; 17 | } 18 | 19 | @Override 20 | public ItemStack deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { 21 | JsonObject object = json.getAsJsonObject(); 22 | return ItemNbt.decompress(object.get("data64").getAsString()); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/number/CompactNumber.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.number; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.NumberUtil; 6 | 7 | public class CompactNumber { 8 | 9 | private final double value; 10 | private final NumberShortcut shortcut; 11 | 12 | public CompactNumber(double value, @Nullable NumberShortcut shortcut) { 13 | this.value = value; 14 | this.shortcut = shortcut; 15 | } 16 | 17 | @NotNull 18 | public String format() { 19 | String num = NumberUtil.format(NumberUtil.round(this.value, 1)); 20 | if (this.shortcut != null) num += this.shortcut.getSymbol(); 21 | 22 | return num; 23 | } 24 | 25 | public double getValue() { 26 | return this.value; 27 | } 28 | 29 | @Nullable 30 | public NumberShortcut getShortcut() { 31 | return this.shortcut; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/NightDataPlugin.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.database.AbstractUserDataHandler; 5 | import su.nightexpress.nightcore.database.AbstractUserManager; 6 | import su.nightexpress.nightcore.database.DataUser; 7 | 8 | @Deprecated 9 | public abstract class NightDataPlugin extends NightPlugin { 10 | 11 | @Override 12 | protected void loadManagers() { 13 | super.loadManagers(); 14 | this.getUserManager().loadOnlineUsers(); 15 | } 16 | 17 | @Override 18 | protected void unloadManagers() { 19 | super.unloadManagers(); 20 | this.getUserManager().shutdown(); 21 | this.getData().shutdown(); 22 | } 23 | 24 | @NotNull 25 | public abstract AbstractUserDataHandler, U> getData(); 26 | 27 | @NotNull 28 | public abstract AbstractUserManager, U> getUserManager(); 29 | } 30 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/currency/listener/CurrencyListener.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.currency.listener; 2 | 3 | import org.bukkit.event.EventHandler; 4 | import org.bukkit.event.EventPriority; 5 | import org.bukkit.event.server.PluginEnableEvent; 6 | import org.jetbrains.annotations.NotNull; 7 | import su.nightexpress.nightcore.NightCore; 8 | import su.nightexpress.nightcore.integration.currency.CurrencyManager; 9 | import su.nightexpress.nightcore.manager.AbstractListener; 10 | 11 | public class CurrencyListener extends AbstractListener { 12 | 13 | private final CurrencyManager manager; 14 | 15 | public CurrencyListener(@NotNull NightCore plugin, @NotNull CurrencyManager manager) { 16 | super(plugin); 17 | this.manager = manager; 18 | } 19 | 20 | @EventHandler(priority = EventPriority.MONITOR) 21 | public void onPluginEnable(PluginEnableEvent event) { 22 | this.manager.handlePluginLoad(event.getPlugin().getName()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/menu/link/Linked.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.menu.link; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.menu.MenuViewer; 6 | import su.nightexpress.nightcore.menu.api.Menu; 7 | 8 | @Deprecated 9 | public interface Linked extends Menu { 10 | 11 | @NotNull ViewLink getLink(); 12 | 13 | default T getLink(@NotNull MenuViewer viewer) { 14 | return this.getLink(viewer.getPlayer()); 15 | } 16 | 17 | default T getLink(@NotNull Player player) { 18 | return this.getLink().get(player); 19 | } 20 | 21 | default boolean isLinkPersistent() { 22 | return false; 23 | } 24 | 25 | default boolean open(@NotNull Player player, @NotNull T obj) { 26 | this.getLink().set(player, obj); 27 | 28 | if (!this.open(player)) { 29 | this.getLink().clear(player); 30 | return false; 31 | } 32 | 33 | return true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/DialogDefaults.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog; 2 | 3 | public class DialogDefaults { 4 | 5 | public static final int DEFAULT_BUTTON_WIDTH = 150; 6 | public static final int DEFAULT_PLAIN_BODY_WIDTH = 200; 7 | public static final int DEFAULT_SINGLE_INPUT_WIDTH = 200; 8 | public static final int DEFAULT_TEXT_INPUT_WIDTH = 200; 9 | public static final int DEFAULT_TEXT_INPUT_LENGTH = 32; 10 | public static final int DEFAULT_NUMBER_INPUT_WIDTH = 200; 11 | 12 | public static final int MIN_WIDTH = 1; 13 | public static final int MAX_WIDTH = 1024; 14 | 15 | public static final int MAX_ITEM_BODY_WIDTH = 256; 16 | public static final int MAX_ITEM_BODY_HEIGHT = 256; 17 | 18 | public static final int DEFAULT_ITEM_BODY_WIDTH = 16; 19 | public static final int DEFAULT_ITEM_BODY_HEIGHT = 16; 20 | 21 | public static int clampWidth(int width) { 22 | return Math.clamp(width, MIN_WIDTH, MAX_WIDTH); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/impl/LineBreakTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.text.tag.TagUtils; 5 | import su.nightexpress.nightcore.util.text.tag.api.PlaceholderTag; 6 | import su.nightexpress.nightcore.util.text.tag.api.Tag; 7 | 8 | @Deprecated 9 | public class LineBreakTag extends Tag implements PlaceholderTag { 10 | 11 | public LineBreakTag() { 12 | super("newline", new String[]{"br"}); 13 | } 14 | 15 | @Override 16 | public boolean isCloseable() { 17 | return false; 18 | } 19 | 20 | @Override 21 | @NotNull 22 | public String getValue() { 23 | return "\n"; 24 | } 25 | 26 | @Deprecated 27 | public String[] split(@NotNull String string) { 28 | for (String alias : this.getAliases()) { 29 | string = string.replace(TagUtils.brackets(alias), "\n"); 30 | } 31 | return string.split("\n"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/type/WrappedServerLinksType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.type; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogTypeAdapter; 6 | import su.nightexpress.nightcore.bridge.dialog.wrap.button.WrappedActionButton; 7 | 8 | import java.util.function.UnaryOperator; 9 | 10 | public record WrappedServerLinksType(@Nullable WrappedActionButton exitAction, int columns, int buttonWidth) implements WrappedDialogType { 11 | 12 | @Override 13 | @NotNull 14 | public T adapt(@NotNull DialogTypeAdapter factory) { 15 | return factory.adaptType(this); 16 | } 17 | 18 | @Override 19 | @NotNull 20 | public WrappedServerLinksType replace(@NotNull UnaryOperator operator) { 21 | return new WrappedServerLinksType(this.exitAction == null ? null : this.exitAction.replace(operator), this.columns, this.buttonWidth); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/menu/click/ClickResult.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.menu.click; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | @Deprecated 7 | public class ClickResult { 8 | 9 | private final int slot; 10 | private final ItemStack itemStack; 11 | private final boolean isMenu; 12 | 13 | public ClickResult(int slot, @Nullable ItemStack itemStack, boolean isMenu) { 14 | this.slot = slot; 15 | this.itemStack = itemStack; 16 | this.isMenu = isMenu; 17 | } 18 | 19 | public int getSlot() { 20 | return slot; 21 | } 22 | 23 | @Nullable 24 | public ItemStack getItemStack() { 25 | return itemStack; 26 | } 27 | 28 | public boolean isEmptySlot() { 29 | return this.itemStack == null || this.itemStack.getType().isAir(); 30 | } 31 | 32 | public boolean isMenu() { 33 | return isMenu; 34 | } 35 | 36 | public boolean isInventory() { 37 | return !this.isMenu(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/menu/click/ClickResult.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.menu.click; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | public class ClickResult { 7 | 8 | private final int slot; 9 | private final ItemStack itemStack; 10 | private final boolean isMenu; 11 | 12 | public ClickResult(int slot, @Nullable ItemStack itemStack, boolean isMenu) { 13 | this.slot = slot; 14 | this.itemStack = itemStack; 15 | this.isMenu = isMenu; 16 | } 17 | 18 | public int getSlot() { 19 | return slot; 20 | } 21 | 22 | @Nullable 23 | public ItemStack getItemStack() { 24 | return itemStack; 25 | } 26 | 27 | public boolean isEmptySlot() { 28 | return this.itemStack == null || this.itemStack.getType().isAir(); 29 | } 30 | 31 | public boolean isMenu() { 32 | return isMenu; 33 | } 34 | 35 | public boolean isInventory() { 36 | return !this.isMenu(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/adapter/DialogInputAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.wrap.input.WrappedBooleanDialogInput; 5 | import su.nightexpress.nightcore.bridge.dialog.wrap.input.WrappedDialogInput; 6 | import su.nightexpress.nightcore.bridge.dialog.wrap.input.WrappedNumberRangeDialogInput; 7 | import su.nightexpress.nightcore.bridge.dialog.wrap.input.single.WrappedSingleOptionDialogInput; 8 | import su.nightexpress.nightcore.bridge.dialog.wrap.input.text.WrappedTextDialogInput; 9 | 10 | public interface DialogInputAdapter { 11 | 12 | @NotNull I adaptInput(@NotNull WrappedDialogInput input); 13 | 14 | @NotNull I adaptInput(@NotNull WrappedTextDialogInput input); 15 | 16 | @NotNull I adaptInput(@NotNull WrappedSingleOptionDialogInput input); 17 | 18 | @NotNull I adaptInput(@NotNull WrappedBooleanDialogInput input); 19 | 20 | @NotNull I adaptInput(@NotNull WrappedNumberRangeDialogInput input); 21 | } 22 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/blocktracker/TrackUtil.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.blocktracker; 2 | 3 | import org.bukkit.Chunk; 4 | import org.bukkit.block.Block; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | public class TrackUtil { 8 | 9 | public static long getChunkKey(@NotNull Chunk chunk) { 10 | return getChunkKey(chunk.getX(), chunk.getZ()); 11 | } 12 | 13 | public static long getChunkKey(final int chunkX, final int chunkZ) { 14 | return (long) chunkX & 0xFFFFFFFFL | ((long) chunkZ & 0xFFFFFFFFL) << 32; 15 | } 16 | 17 | public static long getChunkKeyOfBlock(@NotNull Block block) { 18 | return getChunkKey(block.getX() >> 4, block.getZ() >> 4); 19 | } 20 | 21 | public static int getRelativeChunkPosition(@NotNull Block block) { 22 | final int relX = (block.getX() % 16 + 16) % 16; 23 | final int relZ = (block.getZ() % 16 + 16) % 16; 24 | final int relY = block.getY(); 25 | return (relY & 0xFFFF) | ((relX & 0xFF) << 16) | ((relZ & 0xFF) << 24); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/permission/PermissionBridge.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.permission; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.Optional; 6 | 7 | public class PermissionBridge { 8 | 9 | private static PermissionProvider provider; 10 | 11 | public static void unregisterAll() { 12 | provider = null; 13 | } 14 | 15 | public static void register(@NotNull PermissionProvider permissionProvider) { 16 | provider = permissionProvider; 17 | } 18 | 19 | @NotNull 20 | public static PermissionProvider getProvider() { 21 | if (provider == null) throw new IllegalStateException("No permission provider available! You must check #hasProvider before calling this method."); 22 | return provider; 23 | } 24 | 25 | @NotNull 26 | public static Optional provider() { 27 | return Optional.ofNullable(provider); 28 | } 29 | 30 | public static boolean hasProvider() { 31 | return provider != null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/registry/Holder.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.registry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.function.Consumer; 6 | 7 | public class Holder { 8 | 9 | private T value; 10 | 11 | public void set(@NotNull T value) { 12 | if (this.value != null) throw new IllegalStateException("Holder value already set: " + value); 13 | 14 | this.value = value; 15 | } 16 | 17 | @NotNull 18 | public T get() { 19 | if (this.value == null) throw new IllegalStateException("Holder value is not set"); 20 | 21 | return this.value; 22 | } 23 | 24 | public void clear() { 25 | this.value = null; 26 | } 27 | 28 | public void ifPresent(@NotNull Consumer consumer) { 29 | if (this.value != null) { 30 | consumer.accept(this.value); 31 | } 32 | } 33 | 34 | public boolean isPresent() { 35 | return this.value != null; 36 | } 37 | 38 | public boolean isEmpty() { 39 | return this.value == null; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/ClassicTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.tag.TagHandler; 6 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 7 | 8 | public abstract class ClassicTagHandler implements TagHandler { 9 | 10 | public ClassicTagHandler() { 11 | 12 | } 13 | 14 | @Override 15 | public void handleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 16 | this.onHandleOpen(group, tagContent); 17 | } 18 | 19 | @Override 20 | public void handleClose(@NotNull EntryGroup group) { 21 | this.onHandleClose(group); 22 | } 23 | 24 | protected abstract void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent); 25 | 26 | protected abstract void onHandleClose(@NotNull EntryGroup group); 27 | 28 | @Override 29 | public boolean canBeClosed() { 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/configuration/AbstractConfig.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.configuration; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.config.FileConfig; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class AbstractConfig { 11 | 12 | protected final List> properties = new ArrayList<>(); 13 | 14 | @NotNull 15 | protected final ConfigProperty addProperty(@NotNull ConfigType type, @NotNull String path, @NotNull T defaultValue, @Nullable String... description) { 16 | return this.addProperty(ConfigProperty.of(type, path, defaultValue, description)); 17 | } 18 | 19 | @NotNull 20 | protected final ConfigProperty addProperty(@NotNull ConfigProperty property) { 21 | this.properties.add(property); 22 | return property; 23 | } 24 | 25 | public void load(@NotNull FileConfig config) { 26 | this.properties.forEach(configProperty -> configProperty.loadOrWriteDefault(config)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/entry/LangEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 6 | 7 | public class LangEntry extends ChildEntry { 8 | 9 | private final String key; 10 | private final String fallback; 11 | 12 | public LangEntry(@NotNull EntryGroup parent, @NotNull String key, @Nullable String fallback) { 13 | super(parent); 14 | this.key = key; 15 | this.fallback = fallback; 16 | } 17 | 18 | @NotNull 19 | public String getKey() { 20 | return this.key; 21 | } 22 | 23 | @Nullable 24 | public String getFallback() { 25 | return this.fallback; 26 | } 27 | 28 | @Override 29 | public int textLength() { 30 | return 1; 31 | } 32 | 33 | @Override 34 | @NotNull 35 | public NightComponent toComponent() { 36 | return NightComponent.translatable(this.key, this.fallback, this.parent.style()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/connection/MySQLConnector.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database.connection; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightCorePlugin; 5 | import su.nightexpress.nightcore.database.AbstractConnector; 6 | import su.nightexpress.nightcore.database.DatabaseConfig; 7 | 8 | @Deprecated 9 | public class MySQLConnector extends AbstractConnector { 10 | 11 | public MySQLConnector(@NotNull NightCorePlugin plugin, @NotNull DatabaseConfig config) { 12 | super(plugin, config); 13 | } 14 | 15 | @Override 16 | protected String getURL(@NotNull DatabaseConfig config) { 17 | String host = config.getHost(); 18 | String database = config.getDatabase(); 19 | String options = config.getUrlOptions(); 20 | 21 | return "jdbc:mysql://" + host + "/" + database + options; 22 | } 23 | 24 | @Override 25 | protected void setupConfig(@NotNull DatabaseConfig config) { 26 | this.config.setUsername(config.getUsername()); 27 | this.config.setPassword(config.getPassword()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/permission/PermissionProvider.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.permission; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import java.util.Set; 8 | import java.util.UUID; 9 | import java.util.concurrent.CompletableFuture; 10 | 11 | public interface PermissionProvider { 12 | 13 | //void setup(); 14 | 15 | @NotNull String getName(); 16 | 17 | @Nullable String getPrimaryGroup(@NotNull Player player); 18 | 19 | @NotNull Set getPermissionGroups(@NotNull Player player); 20 | 21 | @Nullable String getPrefix(@NotNull Player player); 22 | 23 | @Nullable String getSuffix(@NotNull Player player); 24 | 25 | @NotNull CompletableFuture getPrimaryGroup(@NotNull UUID playerId); 26 | 27 | @NotNull CompletableFuture> getPermissionGroups(@NotNull UUID playerId); 28 | 29 | @NotNull CompletableFuture getPrefix(@NotNull UUID playerId); 30 | 31 | @NotNull CompletableFuture getSuffix(@NotNull UUID playerId); 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/menu/click/ClickKey.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.menu.click; 2 | 3 | import org.bukkit.event.inventory.ClickType; 4 | import org.bukkit.event.inventory.InventoryClickEvent; 5 | import org.bukkit.inventory.ItemStack; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public enum ClickKey { 9 | 10 | LEFT, RIGHT, SHIFT_LEFT, SHIFT_RIGHT, 11 | DROP_KEY, SWAP_KEY, 12 | DRAG_N_DROP, 13 | ; 14 | 15 | @NotNull 16 | public static ClickKey from(@NotNull InventoryClickEvent event) { 17 | ItemStack cursor = event.getCursor(); 18 | ItemStack target = event.getCurrentItem(); 19 | if (!cursor.getType().isAir() && target != null && !target.getType().isAir()) { 20 | return DRAG_N_DROP; 21 | } 22 | 23 | if (event.getClick() == ClickType.DROP) return DROP_KEY; 24 | if (event.getClick() == ClickType.SWAP_OFFHAND) return SWAP_KEY; 25 | 26 | if (event.isShiftClick()) { 27 | return event.isRightClick() ? SHIFT_RIGHT : SHIFT_LEFT; 28 | } 29 | return event.isRightClick() ? RIGHT : LEFT; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/Engine.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.integration.permission.PermissionBridge; 5 | import su.nightexpress.nightcore.integration.permission.PermissionProvider; 6 | import su.nightexpress.nightcore.util.bridge.Software; 7 | 8 | import java.util.Set; 9 | 10 | @Deprecated 11 | public class Engine { 12 | 13 | @NotNull 14 | @Deprecated 15 | public static Set getChildrens() { 16 | return NightCore.CHILDRENS; 17 | } 18 | 19 | @NotNull 20 | @Deprecated 21 | public static NightCore core() { 22 | return NightCore.get(); 23 | } 24 | 25 | @NotNull 26 | @Deprecated 27 | public static Software software() { 28 | return Software.instance(); 29 | } 30 | 31 | @NotNull 32 | @Deprecated 33 | public static PermissionProvider getPermissions() { 34 | return PermissionBridge.getProvider(); 35 | } 36 | 37 | @Deprecated 38 | public static boolean hasPermissions() { 39 | return PermissionBridge.hasProvider(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/response/DialogClickResult.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.response; 2 | 3 | import org.bukkit.NamespacedKey; 4 | import org.bukkit.entity.Player; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | import su.nightexpress.nightcore.bridge.common.NightNbtHolder; 8 | 9 | public class DialogClickResult { 10 | 11 | private final Player player; 12 | private final NamespacedKey identifier; 13 | private final NightNbtHolder nbtHolder; 14 | 15 | public DialogClickResult(@NotNull Player player, @NotNull NamespacedKey identifier, @Nullable NightNbtHolder nbtHolder) { 16 | this.player = player; 17 | this.identifier = identifier; 18 | this.nbtHolder = nbtHolder; 19 | } 20 | 21 | @NotNull 22 | public Player getPlayer() { 23 | return this.player; 24 | } 25 | 26 | @NotNull 27 | public NamespacedKey getIdentifier() { 28 | return this.identifier; 29 | } 30 | 31 | @Nullable 32 | public NightNbtHolder getNbtHolder() { 33 | return this.nbtHolder; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/api/ComplexTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.api; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 5 | import su.nightexpress.nightcore.util.text.tag.TagUtils; 6 | 7 | @Deprecated 8 | public class ComplexTag extends Tag { 9 | 10 | public ComplexTag(@NotNull String name) { 11 | super(name); 12 | } 13 | 14 | public ComplexTag(@NotNull String name, @NotNull String[] aliases) { 15 | super(name, aliases); 16 | } 17 | 18 | @NotNull 19 | protected String escapeQuotes(@NotNull String content) { 20 | return ParserUtils.escapeQuotes(content); 21 | //return content.replace("'", "\\'").replace("\"", "\\\""); 22 | } 23 | 24 | @NotNull 25 | public String encloseContent(@NotNull String text, @NotNull String content) { 26 | return TagUtils.wrapContent(this, text, content); 27 | // String tagOpen = brackets(this.getName() + ":" + content); 28 | // String tagClose = this.getClosingName(); 29 | // 30 | // return tagOpen + text + tagClose; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/builder/FlagBuilder.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental.builder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.command.experimental.flag.CommandFlag; 6 | import su.nightexpress.nightcore.util.wrapper.UniPermission; 7 | 8 | @Deprecated 9 | public abstract class FlagBuilder> { 10 | 11 | protected final String name; 12 | 13 | protected String permission; 14 | 15 | public FlagBuilder(@NotNull String name) { 16 | this.name = name; 17 | } 18 | 19 | @NotNull 20 | protected abstract FlagBuilder getThis(); 21 | 22 | @NotNull 23 | public FlagBuilder permission(@NotNull UniPermission permission) { 24 | return this.permission(permission.getName()); 25 | } 26 | 27 | @NotNull 28 | public FlagBuilder permission(@Nullable String permission) { 29 | this.permission = permission; 30 | return this.getThis(); 31 | } 32 | 33 | @NotNull 34 | public abstract F build(); 35 | } 36 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/NamedColorTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 6 | 7 | import java.awt.*; 8 | 9 | public class NamedColorTagHandler extends ClassicTagHandler { 10 | 11 | private final String colorName; 12 | private final Color color; 13 | 14 | public NamedColorTagHandler(@NotNull String colorName, @NotNull Color color) { 15 | this.colorName = colorName; 16 | this.color = color; 17 | } 18 | 19 | @NotNull 20 | public String getColorName() { 21 | return this.colorName; 22 | } 23 | 24 | @NotNull 25 | public Color getColor() { 26 | return this.color; 27 | } 28 | 29 | @Override 30 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 31 | group.setStyle(style -> style.color(this.color)); 32 | } 33 | 34 | @Override 35 | protected void onHandleClose(@NotNull EntryGroup group) { 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /utils/src/main/java/su/nightexpress/nightcore/util/nbt/NbtOps.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.nbt; 2 | 3 | import com.mojang.serialization.DynamicOps; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.util.Reflex; 6 | import su.nightexpress.nightcore.util.Version; 7 | 8 | import java.lang.reflect.Method; 9 | 10 | public class NbtOps { 11 | 12 | private static final Class CLS_NBT_OPS = Reflex.safeClass("net.minecraft.nbt", "NbtOps", "DynamicOpsNBT"); 13 | 14 | private static final Method CONVERT_TO = Version.isBehind(Version.MC_1_21_7) ? null : Reflex.safeMethod(CLS_NBT_OPS, "convertTo", DynamicOps.class, Object.class); 15 | 16 | public static final Object INSTANCE = Reflex.getFieldValue(CLS_NBT_OPS, "INSTANCE", "a"); 17 | 18 | @SuppressWarnings("unchecked") 19 | @NotNull 20 | public static T convertTag(@NotNull DynamicOps outOps, @NotNull Object compoundTag) { 21 | T element = (T) Reflex.invokeMethod(CONVERT_TO, INSTANCE, outOps, compoundTag); 22 | if (element == null) throw new IllegalStateException("Could not convert " + compoundTag + " to " + outOps); 23 | 24 | return element; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/item/adapter/AbstractItemAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.item.adapter; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.bridge.item.ItemAdapter; 6 | import su.nightexpress.nightcore.config.FileConfig; 7 | import su.nightexpress.nightcore.integration.item.impl.AdaptedItemStack; 8 | import su.nightexpress.nightcore.integration.item.adapter.impl.VanillaItemAdapter; 9 | import su.nightexpress.nightcore.util.LowerCase; 10 | 11 | public abstract class AbstractItemAdapter implements ItemAdapter { 12 | 13 | protected final String name; 14 | 15 | public AbstractItemAdapter(@NotNull String name) { 16 | this.name = LowerCase.INTERNAL.apply(name); 17 | } 18 | 19 | @Nullable 20 | public abstract AdaptedItemStack readItem(@NotNull FileConfig config, @NotNull String path); 21 | 22 | @Override 23 | @NotNull 24 | public String getName() { 25 | return this.name; 26 | } 27 | 28 | @Override 29 | public boolean isVanilla() { 30 | return this == VanillaItemAdapter.INSTANCE; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/item/impl/AdaptedCustomStack.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.item.impl; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import su.nightexpress.nightcore.bridge.item.ItemAdapter; 7 | import su.nightexpress.nightcore.integration.item.data.ItemIdData; 8 | 9 | public class AdaptedCustomStack extends AdaptedItemStack { 10 | 11 | public AdaptedCustomStack(@NotNull ItemAdapter adapter, @NotNull ItemIdData data) { 12 | super(adapter, data); 13 | } 14 | 15 | @Override 16 | public boolean isValid() { 17 | return this.adapter.canHandle(this.data); 18 | } 19 | 20 | @Override 21 | public int getAmount() { 22 | return this.data.getAmount(); 23 | } 24 | 25 | @Override 26 | @Nullable 27 | public ItemStack getItemStack() { 28 | return this.adapter.toItemStack(this.data); 29 | } 30 | 31 | @Override 32 | public boolean isSimilar(@NotNull ItemIdData other) { 33 | return this.data.getItemId().equalsIgnoreCase(other.getItemId()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/menu/link/ViewLink.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.menu.link; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.menu.MenuViewer; 6 | 7 | import java.util.Map; 8 | import java.util.WeakHashMap; 9 | 10 | @Deprecated 11 | public class ViewLink { 12 | 13 | private final Map map; 14 | 15 | public ViewLink() { 16 | this.map = new WeakHashMap<>(); 17 | } 18 | 19 | public void set(@NotNull MenuViewer viewer, @NotNull T object) { 20 | this.set(viewer.getPlayer(), object); 21 | } 22 | 23 | public void set(@NotNull Player viewer, @NotNull T object) { 24 | this.map.put(viewer, object); 25 | } 26 | 27 | public T get(@NotNull MenuViewer viewer) { 28 | return this.get(viewer.getPlayer()); 29 | } 30 | 31 | public T get(@NotNull Player viewer) { 32 | return this.map.get(viewer); 33 | } 34 | 35 | public void clear(@NotNull MenuViewer viewer) { 36 | this.clear(viewer.getPlayer()); 37 | } 38 | 39 | public void clear(@NotNull Player viewer) { 40 | this.map.remove(viewer); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/base/ReloadSubCommand.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.base; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.permissions.Permission; 5 | import org.jetbrains.annotations.NotNull; 6 | import su.nightexpress.nightcore.NightCorePlugin; 7 | import su.nightexpress.nightcore.command.CommandResult; 8 | import su.nightexpress.nightcore.command.impl.AbstractCommand; 9 | import su.nightexpress.nightcore.core.CoreLang; 10 | 11 | @Deprecated 12 | public class ReloadSubCommand extends AbstractCommand { 13 | 14 | public ReloadSubCommand(@NotNull NightCorePlugin plugin, @NotNull Permission permission) { 15 | this(plugin, permission.getName()); 16 | } 17 | 18 | public ReloadSubCommand(@NotNull NightCorePlugin plugin, @NotNull String permission) { 19 | super(plugin, new String[]{"reload"}, permission); 20 | this.setDescription(CoreLang.COMMAND_RELOAD_DESC); 21 | } 22 | 23 | @Override 24 | protected void onExecute(@NotNull CommandSender sender, @NotNull CommandResult result) { 25 | this.plugin.reload(); 26 | CoreLang.COMMAND_RELOAD_DONE.getMessage(plugin).send(sender); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/viewer/ViewerContext.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.viewer; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | 7 | import java.util.Optional; 8 | 9 | public class ViewerContext { 10 | 11 | protected final MenuViewer viewer; 12 | protected final Object object; 13 | 14 | public ViewerContext(@NotNull MenuViewer viewer, @Nullable Object object) { 15 | this.viewer = viewer; 16 | this.object = object; 17 | } 18 | 19 | @NotNull 20 | public Player getPlayer() { 21 | return this.viewer.getPlayer(); 22 | } 23 | 24 | @NotNull 25 | public MenuViewer getViewer() { 26 | return this.viewer; 27 | } 28 | 29 | @Nullable 30 | public Object getObject() { 31 | return this.object; 32 | } 33 | 34 | @NotNull 35 | public Optional object() { 36 | return Optional.ofNullable(this.object); 37 | } 38 | 39 | @NotNull 40 | public Optional object(@NotNull Class type) { 41 | return this.object().filter(type::isInstance).map(type::cast); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/action/ActionRegistry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.action; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.LowerCase; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.Optional; 10 | 11 | public class ActionRegistry { 12 | 13 | private final Map actionMap; 14 | 15 | public ActionRegistry() { 16 | this.actionMap = new HashMap<>(); 17 | } 18 | 19 | public void register(@NotNull String name, @NotNull MenuItemAction action) { 20 | String id = LowerCase.INTERNAL.apply(name); 21 | if (this.actionMap.containsKey(id)) { 22 | // TODO Warn or exception 23 | return; 24 | } 25 | this.actionMap.put(id, action); 26 | } 27 | 28 | @Nullable 29 | public MenuItemAction getById(@NotNull String id) { 30 | return this.actionMap.get(LowerCase.INTERNAL.apply(id)); 31 | } 32 | 33 | @NotNull 34 | public Optional byId(@NotNull String id) { 35 | return Optional.ofNullable(this.getById(id)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/connection/impl/MySQLConnector.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.connection.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.NightPlugin; 5 | import su.nightexpress.nightcore.db.config.DatabaseConfig; 6 | import su.nightexpress.nightcore.db.connection.AbstractConnector; 7 | 8 | public class MySQLConnector extends AbstractConnector { 9 | 10 | public MySQLConnector(@NotNull NightPlugin plugin, @NotNull DatabaseConfig config) { 11 | super(plugin, config); 12 | } 13 | 14 | @Override 15 | protected String getURL(@NotNull DatabaseConfig databaseConfig) { 16 | String host = databaseConfig.getHost(); 17 | String database = databaseConfig.getDatabase(); 18 | String options = databaseConfig.getUrlOptions(); 19 | 20 | return "jdbc:mysql://" + host + "/" + database + options; 21 | } 22 | 23 | @Override 24 | protected void setupConfig(@NotNull DatabaseConfig databaseConfig) { 25 | this.config.setUsername(databaseConfig.getUsername()); 26 | this.config.setPassword(databaseConfig.getPassword()); 27 | this.config.setMaxLifetime(databaseConfig.getMaxLifetime()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/impl/TranslationTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 6 | import su.nightexpress.nightcore.util.text.tag.TagUtils; 7 | import su.nightexpress.nightcore.util.text.tag.api.Tag; 8 | 9 | @Deprecated 10 | public class TranslationTag extends Tag { 11 | 12 | public static final String NAME = "lang"; 13 | 14 | public TranslationTag() { 15 | super(NAME, new String[]{"lang_or", "tr", "tr_or", "translation", "translation_or", "translate", "translate_or"}); 16 | } 17 | 18 | @NotNull 19 | public String wrap(@NotNull String translationKey) { 20 | return this.wrap(translationKey, null); 21 | } 22 | 23 | @NotNull 24 | public String wrap(@NotNull String translationKey, @Nullable String fallback) { 25 | String full = this.getName() + ParserUtils.DELIMITER + ParserUtils.quoted(translationKey); 26 | if (fallback != null) { 27 | full += ParserUtils.DELIMITER + ParserUtils.quoted(fallback); 28 | } 29 | 30 | return TagUtils.brackets(full); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/TagPool.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.text.night.tag.handler.*; 5 | 6 | import java.util.function.Predicate; 7 | 8 | public interface TagPool extends Predicate { 9 | 10 | TagPool ALL = tag -> true; 11 | TagPool NONE = tag -> false; 12 | 13 | TagPool BASE_COLORS = tag -> tag instanceof ColorTagHandler || tag instanceof NamedColorTagHandler; 14 | TagPool ADVANCED_COLORS = tag -> tag instanceof GradientTagHandler || tag instanceof ShadowTagHandler; 15 | TagPool DECORATIONS = tag -> tag instanceof DecorationTagHandler; 16 | 17 | TagPool NO_INVERTED_DECORATIONS = tag -> !(tag instanceof DecorationTagHandler handler) || !handler.isInverted(); 18 | 19 | Predicate ALL_COLORS = BASE_COLORS.and(ADVANCED_COLORS); 20 | Predicate BASE_COLORS_AND_DECORATIONS = BASE_COLORS.and(DECORATIONS); 21 | Predicate ALL_COLORS_AND_DECORATIONS = ALL_COLORS.and(DECORATIONS); 22 | 23 | default boolean isGoodTag(@NotNull TagHandler handler) { 24 | return this.test(handler); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/locale/message/impl/ActionBarMessage.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.locale.message.impl; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | import org.jetbrains.annotations.NotNull; 6 | import su.nightexpress.nightcore.locale.message.LangMessage; 7 | import su.nightexpress.nightcore.locale.message.MessageData; 8 | import su.nightexpress.nightcore.util.Players; 9 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 10 | import su.nightexpress.nightcore.util.text.night.NightMessage; 11 | 12 | import java.util.Collection; 13 | 14 | public class ActionBarMessage extends LangMessage { 15 | 16 | public ActionBarMessage(@NotNull String text, @NotNull MessageData data) { 17 | super(text, data); 18 | } 19 | 20 | @Override 21 | public boolean isSilent() { 22 | return false; 23 | } 24 | 25 | @Override 26 | protected void send(@NotNull Collection receivers, @NotNull String text) { 27 | NightComponent component = NightMessage.parse(text); 28 | receivers.forEach(sender -> { 29 | if (sender instanceof Player player) Players.sendActionBar(player, component); 30 | }); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/UIUtils.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.Engine; 6 | import su.nightexpress.nightcore.NightCore; 7 | import su.nightexpress.nightcore.ui.menu.confirmation.ConfirmMenu; 8 | import su.nightexpress.nightcore.ui.menu.confirmation.Confirmation; 9 | import su.nightexpress.nightcore.util.Version; 10 | 11 | @Deprecated 12 | public class UIUtils { 13 | 14 | private static ConfirmMenu confirmMenu; 15 | 16 | public static void load(@NotNull NightCore plugin) { 17 | if (Version.isAtLeast(Version.MC_1_21)) { 18 | confirmMenu = new ConfirmMenu(plugin); 19 | } 20 | } 21 | 22 | public static void clear() { 23 | if (confirmMenu != null) { 24 | confirmMenu.clear(); 25 | confirmMenu = null; 26 | } 27 | } 28 | 29 | public static void openConfirmation(@NotNull Player player, @NotNull Confirmation confirmation) { 30 | if (confirmMenu == null) { 31 | Engine.core().error("[UIUtils] Unsupported server version."); 32 | return; 33 | } 34 | confirmMenu.open(player, confirmation); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/body/WrappedPlainMessageDialogBody.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.body; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.DialogDefaults; 5 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogBodyAdapter; 6 | 7 | import java.util.function.UnaryOperator; 8 | 9 | public record WrappedPlainMessageDialogBody(@NotNull String contents, int width) implements WrappedDialogBody { 10 | 11 | public WrappedPlainMessageDialogBody(@NotNull String contents) { 12 | this(contents, DialogDefaults.DEFAULT_PLAIN_BODY_WIDTH); 13 | } 14 | 15 | public WrappedPlainMessageDialogBody(@NotNull String contents, int width) { 16 | this.contents = contents; 17 | this.width = DialogDefaults.clampWidth(width); 18 | } 19 | 20 | @Override 21 | @NotNull 22 | public D adapt(@NotNull DialogBodyAdapter adapter) { 23 | return adapter.adaptBody(this); 24 | } 25 | 26 | @Override 27 | @NotNull 28 | public WrappedPlainMessageDialogBody replace(@NotNull UnaryOperator operator) { 29 | return new WrappedPlainMessageDialogBody(operator.apply(this.contents), this.width); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/argument/type/BoolArgumentType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.argument.type; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.commands.SuggestionsProvider; 5 | import su.nightexpress.nightcore.commands.argument.ArgumentReader; 6 | import su.nightexpress.nightcore.commands.argument.ArgumentType; 7 | import su.nightexpress.nightcore.commands.context.CommandContext; 8 | import su.nightexpress.nightcore.commands.context.CommandContextBuilder; 9 | import su.nightexpress.nightcore.commands.exceptions.CommandSyntaxException; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class BoolArgumentType implements ArgumentType, SuggestionsProvider { 15 | 16 | private static final List EXAMPLES = Arrays.asList("true", "false"); 17 | 18 | @Override 19 | @NotNull 20 | public Boolean parse(@NotNull CommandContextBuilder contextBuilder, @NotNull String string) throws CommandSyntaxException { 21 | return Boolean.parseBoolean(string); 22 | } 23 | 24 | @Override 25 | @NotNull 26 | public List suggest(@NotNull ArgumentReader reader, @NotNull CommandContext context) { 27 | return EXAMPLES; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/item/data/ItemIdData.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.item.data; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.config.FileConfig; 5 | import su.nightexpress.nightcore.config.Writeable; 6 | 7 | public class ItemIdData implements Writeable { 8 | 9 | private final String itemId; 10 | private final int amount; 11 | 12 | public ItemIdData(@NotNull String itemId, int amount) { 13 | this.itemId = itemId; 14 | this.amount = amount; 15 | } 16 | 17 | @NotNull 18 | public static ItemIdData read(@NotNull FileConfig config, @NotNull String path) { 19 | String itemId = config.getString(path + ".ID", "null"); 20 | int amount = config.getInt(path + ".Amount"); 21 | 22 | return new ItemIdData(itemId, amount); 23 | } 24 | 25 | @Override 26 | public void write(@NotNull FileConfig config, @NotNull String path) { 27 | config.set(path + ".ID", this.itemId); 28 | config.set(path + ".Amount", this.amount); 29 | } 30 | 31 | @NotNull 32 | public String getItemId() { 33 | return this.itemId; 34 | } 35 | 36 | public int getAmount() { 37 | return this.amount; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/language/tag/MessageTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.language.tag; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.language.message.MessageOptions; 6 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 7 | import su.nightexpress.nightcore.util.text.tag.TagUtils; 8 | import su.nightexpress.nightcore.util.text.tag.api.Tag; 9 | 10 | @Deprecated 11 | public abstract class MessageTag extends Tag { 12 | 13 | public MessageTag(@NotNull String name) { 14 | super(name); 15 | } 16 | 17 | public MessageTag(@NotNull String name, @NotNull String[] aliases) { 18 | super(name, aliases); 19 | } 20 | 21 | @NotNull 22 | @Deprecated 23 | public String enclose(@NotNull String content) { 24 | return this.wrap(content);//brackets(this.getName() + ":\"" + content + "\""); 25 | } 26 | 27 | @NotNull 28 | public String wrap(@NotNull String content) { 29 | return TagUtils.brackets(this.getName() + ParserUtils.DELIMITER + ParserUtils.quoted(content));// ":\"" + content + "\""); 30 | } 31 | 32 | public abstract void apply(@NotNull MessageOptions options, @Nullable String tagContent); 33 | } 34 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/BossBarUtils.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.bossbar.NightBarColor; 5 | import su.nightexpress.nightcore.bridge.bossbar.NightBarFlag; 6 | import su.nightexpress.nightcore.bridge.bossbar.NightBarOverlay; 7 | import su.nightexpress.nightcore.bridge.bossbar.NightBossBar; 8 | import su.nightexpress.nightcore.util.bridge.Software; 9 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 10 | import su.nightexpress.nightcore.util.text.night.NightMessage; 11 | 12 | public class BossBarUtils { 13 | 14 | @NotNull 15 | public static NightBossBar createBossBar(@NotNull String title, @NotNull NightBarColor color, @NotNull NightBarOverlay overlay, @NotNull NightBarFlag... flags) { 16 | NightComponent titleComponent = NightMessage.parse(title); 17 | return createBossBar(titleComponent, color, overlay, flags); 18 | } 19 | 20 | @NotNull 21 | public static NightBossBar createBossBar(@NotNull NightComponent title, @NotNull NightBarColor color, @NotNull NightBarOverlay overlay, @NotNull NightBarFlag... flags) { 22 | return Software.instance().createBossBar(title, color, overlay, flags); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/entry/TextEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 5 | 6 | public class TextEntry extends ChildEntry { 7 | 8 | private final String text; 9 | 10 | public TextEntry(@NotNull EntryGroup parent, @NotNull String text) { 11 | super(parent); 12 | this.text = text; 13 | } 14 | 15 | @NotNull 16 | public String text() { 17 | return this.text; 18 | } 19 | 20 | @Override 21 | public int textLength() { 22 | int legnth = 0; 23 | for (int index = 0; index < this.text.length(); index++) { 24 | char letter = this.text.charAt(index); 25 | if (Character.isWhitespace(letter)) continue; 26 | 27 | legnth++; 28 | } 29 | 30 | return legnth; 31 | } 32 | 33 | @Override 34 | @NotNull 35 | public NightComponent toComponent() { 36 | return NightComponent.text(this.text, this.parent.style()); 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "TextEntry{" + 42 | "text='" + text + '\'' + 43 | '}'; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/regex/TimeoutCharSequence.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.regex; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public class TimeoutCharSequence implements CharSequence { 6 | 7 | private final CharSequence chars; 8 | private final long timeout; 9 | private final long maxTime; 10 | 11 | public TimeoutCharSequence(@NotNull CharSequence chars, long timeout) { 12 | this.chars = chars; 13 | this.timeout = timeout; 14 | this.maxTime = (System.currentTimeMillis() + timeout); 15 | } 16 | 17 | @Override 18 | public char charAt(int index) { 19 | if (System.currentTimeMillis() > this.maxTime) { 20 | throw new MatcherTimeoutException(this.chars, this.timeout); 21 | } 22 | return this.chars.charAt(index); 23 | } 24 | 25 | @Override 26 | public int length() { 27 | return this.chars.length(); 28 | } 29 | 30 | @Override 31 | @NotNull 32 | public CharSequence subSequence(int start, int end) { 33 | return new TimeoutCharSequence(this.chars.subSequence(start, end), this.timeout); 34 | } 35 | 36 | @Override 37 | @NotNull 38 | public String toString() { 39 | return this.chars.toString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/entry/SpriteEntry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.entry; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.bridge.common.NightKey; 6 | import su.nightexpress.nightcore.bridge.text.contents.NightObjectContents; 7 | import su.nightexpress.nightcore.bridge.text.contents.NightSpriteObjectContents; 8 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 9 | 10 | public class SpriteEntry extends ChildEntry { 11 | 12 | private final NightKey atlas; 13 | private final NightKey sprite; 14 | 15 | public SpriteEntry(@NotNull EntryGroup parent, @Nullable NightKey atlas, @NotNull NightKey sprite) { 16 | super(parent); 17 | this.atlas = atlas; 18 | this.sprite = sprite; 19 | } 20 | 21 | @Override 22 | public int textLength() { 23 | return 1; 24 | } 25 | 26 | @Override 27 | @NotNull 28 | public NightComponent toComponent() { 29 | NightSpriteObjectContents contents = this.atlas == null ? NightObjectContents.sprite(this.sprite) : NightObjectContents.sprite(this.atlas, this.sprite); 30 | return NightComponent.object(this.parent.style(), contents); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/DataUser.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database; 2 | 3 | import org.bukkit.OfflinePlayer; 4 | import org.bukkit.entity.Player; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import java.util.UUID; 9 | 10 | @Deprecated 11 | public interface DataUser { 12 | 13 | void onLoad(); 14 | 15 | void onUnload(); 16 | 17 | boolean isCacheExpired(); 18 | 19 | boolean isAutoSaveReady(); 20 | 21 | boolean isSyncReady(); 22 | 23 | long getCachedUntil(); 24 | 25 | long getAutoSaveIn(); 26 | 27 | long getNextSyncIn(); 28 | 29 | void cancelAutoSave(); 30 | 31 | void cancelSynchronization(); 32 | 33 | void setCachedUntil(long cachedUntil); 34 | 35 | void setAutoSaveIn(double seconds); 36 | 37 | void setNextSyncIn(int seconds); 38 | 39 | @NotNull UUID getId(); 40 | 41 | @NotNull String getName(); 42 | 43 | void setName(String name); 44 | 45 | long getDateCreated(); 46 | 47 | void setDateCreated(long dateCreated); 48 | 49 | long getLastOnline(); 50 | 51 | void setLastOnline(long lastOnline); 52 | 53 | boolean isOnline(); 54 | 55 | @NotNull OfflinePlayer getOfflinePlayer(); 56 | 57 | @Nullable Player getPlayer(); 58 | } 59 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/tag/impl/ShortHexColorTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.tag.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 6 | import su.nightexpress.nightcore.util.text.tag.api.ContentTag; 7 | import su.nightexpress.nightcore.util.text.tag.api.Tag; 8 | import su.nightexpress.nightcore.util.text.tag.decorator.BaseColorDecorator; 9 | 10 | import java.awt.*; 11 | 12 | @Deprecated 13 | public class ShortHexColorTag extends Tag implements ContentTag { 14 | 15 | public static final String NAME = "#"; 16 | 17 | public ShortHexColorTag() { 18 | super(NAME); 19 | } 20 | 21 | @Override 22 | @Nullable 23 | public BaseColorDecorator parse(@NotNull String tagContent) { 24 | if (tagContent.length() < 7) return null; 25 | 26 | Color color = ParserUtils.colorFromHexString(tagContent); 27 | return new BaseColorDecorator(color); 28 | 29 | // try { 30 | // Color color = Color.decode(tagContent); 31 | // return new BaseColorDecorator(color); 32 | // } 33 | // catch (NumberFormatException exception) { 34 | // return null; 35 | // } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/Pair.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.Objects; 6 | 7 | @Deprecated 8 | public class Pair { 9 | 10 | private final F first; 11 | private final S second; 12 | 13 | public Pair(@NotNull F first, @NotNull S second) { 14 | this.first = first; 15 | this.second = second; 16 | } 17 | 18 | @NotNull 19 | public F getFirst() { 20 | return this.first; 21 | } 22 | 23 | @NotNull 24 | public S getSecond() { 25 | return this.second; 26 | } 27 | 28 | @NotNull 29 | public Pair swap() { 30 | return of(this.second, this.first); 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "Pair{" + "first=" + first + ", second=" + second + '}'; 36 | } 37 | 38 | @Override 39 | public boolean equals(Object obj) { 40 | if (obj instanceof Pair other) { 41 | return Objects.equals(this.first, other.first) && Objects.equals(this.second, other.second); 42 | } 43 | return false; 44 | } 45 | 46 | @NotNull 47 | public static Pair of(@NotNull F first, @NotNull S second) { 48 | return new Pair<>(first, second); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/wrapper/UniPermission.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.wrapper; 2 | 3 | import org.bukkit.permissions.Permission; 4 | import org.bukkit.permissions.PermissionDefault; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | public class UniPermission extends Permission { 9 | 10 | public UniPermission(@NotNull String name) { 11 | this(name, null, null); 12 | } 13 | 14 | public UniPermission(@NotNull String name, @Nullable PermissionDefault defaultValue) { 15 | this(name, null, defaultValue); 16 | } 17 | 18 | public UniPermission(@NotNull String name, @Nullable String description) { 19 | this(name, description, PermissionDefault.OP); 20 | } 21 | 22 | public UniPermission(@NotNull String name, @Nullable String description, @Nullable PermissionDefault defaultValue) { 23 | super(name, description, defaultValue); 24 | } 25 | 26 | @NotNull 27 | public UniPermission description(String... desc) { 28 | this.setDescription(String.join(" ", desc)); 29 | return this; 30 | } 31 | 32 | public void addChildren(@NotNull Permission... childrens) { 33 | for (Permission children : childrens) { 34 | children.addParent(this, true); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/DecorationTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.bridge.text.NightTextDecoration; 6 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 7 | 8 | public class DecorationTagHandler extends ClassicTagHandler { 9 | 10 | private final NightTextDecoration decoration; 11 | private final boolean state; 12 | 13 | DecorationTagHandler(@NotNull NightTextDecoration decoration, boolean state) { 14 | this.decoration = decoration; 15 | this.state = state; 16 | } 17 | 18 | @NotNull 19 | public static DecorationTagHandler normal(@NotNull NightTextDecoration decoration, boolean state) { 20 | return new DecorationTagHandler(decoration, state); 21 | } 22 | 23 | @Override 24 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 25 | group.setStyle(style -> style.decoration(this.decoration, this.state)); 26 | } 27 | 28 | @Override 29 | protected void onHandleClose(@NotNull EntryGroup group) { 30 | 31 | } 32 | 33 | public boolean isInverted() { 34 | return !this.state; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/text/event/WrappedPayload.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.text.event; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.common.NightKey; 5 | import su.nightexpress.nightcore.bridge.common.NightNbtHolder; 6 | import su.nightexpress.nightcore.bridge.dialog.wrap.WrappedDialog; 7 | 8 | public interface WrappedPayload { 9 | 10 | record Text(@NotNull String value) implements WrappedPayload {} 11 | 12 | record Int(int integer) implements WrappedPayload {} 13 | 14 | record Custom(@NotNull NightKey key, @NotNull NightNbtHolder nbt) implements WrappedPayload {} 15 | 16 | record Dialog(@NotNull WrappedDialog dialog) implements WrappedPayload {} 17 | 18 | @NotNull 19 | static WrappedPayload.Text string(@NotNull String value) { 20 | return new Text(value); 21 | } 22 | 23 | @NotNull 24 | static WrappedPayload.Int integer(int integer) { 25 | return new Int(integer); 26 | } 27 | 28 | @NotNull 29 | static WrappedPayload.Dialog dialog(@NotNull WrappedDialog dialog) { 30 | return new Dialog(dialog); 31 | } 32 | 33 | // BinaryTagHolder nbt 34 | @NotNull 35 | static WrappedPayload.Custom custom(@NotNull NightKey key, @NotNull NightNbtHolder nbt) { 36 | return new Custom(key, nbt); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/tree/ExecutableNode.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.tree; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.commands.CommandRequirement; 6 | import su.nightexpress.nightcore.commands.NodeExecutor; 7 | import su.nightexpress.nightcore.commands.context.CommandContext; 8 | 9 | import java.util.List; 10 | 11 | public abstract class ExecutableNode extends CommandNode { 12 | 13 | protected final String description; 14 | protected final NodeExecutor executor; 15 | 16 | public ExecutableNode(@NotNull String name, 17 | @NotNull String description, 18 | @Nullable String permission, 19 | @NotNull List requirements, 20 | @Nullable NodeExecutor executor) { 21 | super(name, permission, requirements); 22 | this.description = description; 23 | this.executor = executor; 24 | } 25 | 26 | public abstract boolean run(@NotNull CommandContext context); 27 | 28 | @NotNull 29 | public String getDescription() { 30 | return this.description; 31 | } 32 | 33 | @Nullable 34 | public NodeExecutor getExecutor() { 35 | return this.executor; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/item/adapter/impl/NexoAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.item.adapter.impl; 2 | 3 | import com.nexomc.nexo.api.NexoItems; 4 | import com.nexomc.nexo.items.ItemBuilder; 5 | import org.bukkit.inventory.ItemStack; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import su.nightexpress.nightcore.integration.item.data.ItemIdData; 9 | import su.nightexpress.nightcore.integration.item.adapter.IdentifiableItemAdapter; 10 | 11 | public class NexoAdapter extends IdentifiableItemAdapter { 12 | 13 | public NexoAdapter() { 14 | super("nexo"); 15 | } 16 | 17 | @Override 18 | @Nullable 19 | public ItemStack createItem(@NotNull String itemId) { 20 | ItemBuilder builder = NexoItems.itemFromId(itemId); 21 | return builder == null ? null : builder.build(); 22 | } 23 | 24 | @Override 25 | public boolean canHandle(@NotNull ItemStack itemStack) { 26 | return NexoItems.exists(itemStack); 27 | } 28 | 29 | @Override 30 | public boolean canHandle(@NotNull ItemIdData data) { 31 | return NexoItems.exists(data.getItemId()); 32 | } 33 | 34 | @Override 35 | @Nullable 36 | public String getItemId(@NotNull ItemStack item) { 37 | return NexoItems.idFromItem(item); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/condition/ConditionRegistry.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.condition; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.ui.inventory.action.ActionContext; 6 | import su.nightexpress.nightcore.util.LowerCase; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | import java.util.Optional; 11 | import java.util.function.Predicate; 12 | 13 | public class ConditionRegistry { 14 | 15 | private final Map conditionMap; 16 | 17 | public ConditionRegistry() { 18 | this.conditionMap = new HashMap<>(); 19 | } 20 | 21 | public void register(@NotNull String name, @NotNull ItemStateCondition condition) { 22 | String id = LowerCase.INTERNAL.apply(name); 23 | if (this.conditionMap.containsKey(id)) { 24 | // TODO Warn or exception 25 | return; 26 | } 27 | this.conditionMap.put(id, condition); 28 | } 29 | 30 | @Nullable 31 | public ItemStateCondition getById(@NotNull String id) { 32 | return this.conditionMap.get(LowerCase.INTERNAL.apply(id)); 33 | } 34 | 35 | @NotNull 36 | public Optional byId(@NotNull String id) { 37 | return Optional.ofNullable(this.getById(id)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/src/main/resources/paper-plugin.yml: -------------------------------------------------------------------------------- 1 | main: su.nightexpress.nightcore.NightCore 2 | bootstrapper: su.nightexpress.nightcore.NightCoreBootstrap 3 | loader: su.nightexpress.nightcore.NightCoreLoader 4 | name: nightcore 5 | version: '${project.version}' 6 | description: Plugin engine 7 | load: STARTUP 8 | authors: 9 | - NightExpress 10 | api-version: 1.21 11 | dependencies: 12 | server: 13 | Vault: 14 | required: false 15 | LuckPerms: 16 | required: false 17 | PlaceholderAPI: 18 | required: false 19 | floodgate: 20 | required: false 21 | CoinsEngine: 22 | load: AFTER 23 | required: false 24 | BeastTokens: 25 | load: AFTER 26 | required: false 27 | EliteMobs: 28 | load: AFTER 29 | required: false 30 | PlayerPoints: 31 | load: AFTER 32 | required: false 33 | UltraEconomy: 34 | load: AFTER 35 | required: false 36 | VotingPlugin: 37 | load: AFTER 38 | required: false 39 | ExcellentCrates: 40 | load: AFTER 41 | required: false 42 | ExecutableItems: 43 | load: AFTER 44 | required: false 45 | ItemsAdder: 46 | load: AFTER 47 | required: false 48 | MMOItems: 49 | load: AFTER 50 | required: false 51 | Nexo: 52 | load: AFTER 53 | required: false 54 | Oraxen: 55 | load: AFTER 56 | required: false -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/item/adapter/impl/OraxenAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.item.adapter.impl; 2 | 3 | import io.th0rgal.oraxen.api.OraxenItems; 4 | import io.th0rgal.oraxen.items.ItemBuilder; 5 | import org.bukkit.inventory.ItemStack; 6 | import org.jetbrains.annotations.NotNull; 7 | import org.jetbrains.annotations.Nullable; 8 | import su.nightexpress.nightcore.integration.item.data.ItemIdData; 9 | import su.nightexpress.nightcore.integration.item.adapter.IdentifiableItemAdapter; 10 | 11 | public class OraxenAdapter extends IdentifiableItemAdapter { 12 | 13 | public OraxenAdapter() { 14 | super("oraxen"); 15 | } 16 | 17 | @Override 18 | @Nullable 19 | public ItemStack createItem(@NotNull String itemId) { 20 | ItemBuilder builder = OraxenItems.getItemById(itemId); 21 | return builder == null ? null : builder.build(); 22 | } 23 | 24 | @Override 25 | public boolean canHandle(@NotNull ItemStack itemStack) { 26 | return OraxenItems.exists(itemStack); 27 | } 28 | 29 | @Override 30 | public boolean canHandle(@NotNull ItemIdData data) { 31 | return OraxenItems.exists(data.getItemId()); 32 | } 33 | 34 | @Override 35 | @Nullable 36 | public String getItemId(@NotNull ItemStack itemStack) { 37 | return OraxenItems.getIdByItem(itemStack); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/text/adapter/TextComponentAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.text.adapter; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | import org.jetbrains.annotations.NotNull; 6 | import su.nightexpress.nightcore.bridge.text.impl.NightKeybindComponent; 7 | import su.nightexpress.nightcore.bridge.text.impl.NightObjectComponent; 8 | import su.nightexpress.nightcore.bridge.text.impl.NightTextComponent; 9 | import su.nightexpress.nightcore.bridge.text.impl.NightTranslatableComponent; 10 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 11 | 12 | public interface TextComponentAdapter { 13 | 14 | void send(@NotNull CommandSender sender, @NotNull NightComponent component); 15 | 16 | void sendActionBar(@NotNull Player player, @NotNull NightComponent component); 17 | 18 | @NotNull String toJson(@NotNull NightComponent component); 19 | 20 | @NotNull String toLegacy(@NotNull NightComponent component); 21 | 22 | @NotNull C adaptComponent(@NotNull NightComponent component); 23 | 24 | @NotNull C adaptComponent(@NotNull NightTextComponent component); 25 | 26 | @NotNull C adaptComponent(@NotNull NightKeybindComponent component); 27 | 28 | @NotNull C adaptComponent(@NotNull NightTranslatableComponent component); 29 | 30 | @NotNull C adaptComponent(@NotNull NightObjectComponent component); 31 | } 32 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/currency/Currency.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.currency; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.inventory.ItemStack; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.UUID; 8 | import java.util.function.UnaryOperator; 9 | 10 | public interface Currency { 11 | 12 | boolean isDummy(); 13 | 14 | @NotNull UnaryOperator replacePlaceholders(); 15 | 16 | double floorIfNeeded(double amount); 17 | 18 | @NotNull String formatValue(double amount); 19 | 20 | @NotNull String format(double amount); 21 | 22 | @NotNull String applyFormat(@NotNull String format, double amount); 23 | 24 | 25 | 26 | double getBalance(@NotNull Player player); 27 | 28 | double getBalance(@NotNull UUID playerId); 29 | 30 | void give(@NotNull Player player, double amount); 31 | 32 | void give(@NotNull UUID playerId, double amount); 33 | 34 | void take(@NotNull Player player, double amount); 35 | 36 | void take(@NotNull UUID playerId, double amount); 37 | 38 | 39 | 40 | boolean canHandleDecimals(); 41 | 42 | boolean canHandleOffline(); 43 | 44 | 45 | 46 | @NotNull String getOriginalId(); 47 | 48 | @NotNull String getInternalId(); 49 | 50 | @NotNull String getName(); 51 | 52 | @NotNull String getFormat(); 53 | 54 | @NotNull ItemStack getIcon(); // TODO NightItem 55 | } 56 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/argument/type/StringArgumentType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.argument.type; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.commands.SuggestionsProvider; 5 | import su.nightexpress.nightcore.commands.argument.ArgumentReader; 6 | import su.nightexpress.nightcore.commands.argument.ArgumentType; 7 | import su.nightexpress.nightcore.commands.context.CommandContext; 8 | import su.nightexpress.nightcore.commands.context.CommandContextBuilder; 9 | import su.nightexpress.nightcore.commands.exceptions.CommandSyntaxException; 10 | import su.nightexpress.nightcore.util.Lists; 11 | 12 | import java.util.List; 13 | 14 | public class StringArgumentType implements ArgumentType, SuggestionsProvider { 15 | 16 | private final boolean greedy; 17 | 18 | public StringArgumentType(boolean greedy) { 19 | this.greedy = greedy; 20 | } 21 | 22 | @Override 23 | @NotNull 24 | public String parse(@NotNull CommandContextBuilder contextBuilder, @NotNull String string) throws CommandSyntaxException { 25 | return string; 26 | } 27 | 28 | @Override 29 | @NotNull 30 | public List suggest(@NotNull ArgumentReader reader, @NotNull CommandContext context) { 31 | return Lists.newList(""); 32 | } 33 | 34 | public boolean isGreedy() { 35 | return this.greedy; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/sql/query/impl/DeleteQuery.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.sql.query.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.db.sql.query.type.ConditionalQuery; 5 | 6 | import java.sql.PreparedStatement; 7 | import java.sql.SQLException; 8 | 9 | public class DeleteQuery extends ConditionalQuery, T> { 10 | 11 | public DeleteQuery() { 12 | 13 | } 14 | 15 | @Override 16 | protected DeleteQuery getThis() { 17 | return this; 18 | } 19 | 20 | @Override 21 | public boolean isEmpty() { 22 | return false; 23 | } 24 | 25 | @Override 26 | @NotNull 27 | protected String buildSQL(@NotNull String table) { 28 | StringBuilder builder = new StringBuilder().append("DELETE FROM ").append(table); 29 | 30 | String wheres = this.buildWhereSQLPart(); 31 | if (!wheres.isBlank()) { 32 | builder.append(" WHERE ").append(wheres); 33 | } 34 | 35 | return builder.toString(); 36 | } 37 | 38 | @Override 39 | public void onExecute(@NotNull PreparedStatement statement, @NotNull T entity) throws SQLException { 40 | int paramCount = 1; 41 | 42 | for (int index = 0; index < this.countWhereColumns(); index++) { 43 | statement.setString(paramCount++, this.getWhereValue(entity, index)); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/LangNode.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.bridge.wrapper.NightComponent; 6 | import su.nightexpress.nightcore.util.text.tag.decorator.ColorDecorator; 7 | import su.nightexpress.nightcore.util.text.tag.decorator.Decorator; 8 | 9 | @Deprecated 10 | public class LangNode extends TextChildren { 11 | 12 | private final String key; 13 | private final String fallback; 14 | 15 | public LangNode(@NotNull TextGroup parent, @NotNull String key, @Nullable String fallback) { 16 | super(parent); 17 | this.key = key; 18 | this.fallback = fallback; 19 | } 20 | 21 | @Override 22 | public int textLength() { 23 | return 1; 24 | } 25 | 26 | @Override 27 | @NotNull 28 | public NightComponent toComponent() { 29 | ColorDecorator colorDecorator = this.parent.getColor(); 30 | NightComponent component = NightComponent.translatable(this.key, this.fallback); 31 | 32 | if (colorDecorator != null) { 33 | component = colorDecorator.decorate(component); 34 | } 35 | 36 | for (Decorator decorator : this.parent.getDecorators()) { 37 | component = decorator.decorate(component); 38 | } 39 | 40 | return component; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/CommandRequirement.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | import org.jetbrains.annotations.NotNull; 6 | import su.nightexpress.nightcore.core.config.CoreLang; 7 | import su.nightexpress.nightcore.locale.entry.MessageLocale; 8 | 9 | import java.util.function.Predicate; 10 | 11 | public class CommandRequirement { 12 | 13 | private final Predicate predicate; 14 | private final MessageLocale message; 15 | 16 | public CommandRequirement(@NotNull Predicate predicate, @NotNull MessageLocale message) { 17 | this.predicate = predicate; 18 | this.message = message; 19 | } 20 | 21 | @NotNull 22 | public static CommandRequirement playerOnly() { 23 | return new CommandRequirement(sender -> sender instanceof Player, CoreLang.COMMAND_EXECUTION_PLAYER_ONLY); 24 | } 25 | 26 | @NotNull 27 | public static CommandRequirement custom(@NotNull Predicate predicate, @NotNull MessageLocale message) { 28 | return new CommandRequirement(predicate, message); 29 | } 30 | 31 | public boolean test(@NotNull CommandSender sender) { 32 | return this.predicate.test(sender); 33 | } 34 | 35 | @NotNull 36 | public MessageLocale getMessage() { 37 | return this.message; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/builder/ContentFlagBuilder.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental.builder; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.command.experimental.argument.ArgumentParser; 5 | import su.nightexpress.nightcore.command.experimental.flag.ContentFlag; 6 | 7 | @Deprecated 8 | public class ContentFlagBuilder extends FlagBuilder, ContentFlagBuilder> { 9 | 10 | private final ArgumentParser parser; 11 | 12 | private String sample; 13 | 14 | // public ContentFlagBuilder(@NotNull String name, @NotNull Function parser) { 15 | // super(name); 16 | // this.parser = parser; 17 | // this.sample = ""; 18 | // } 19 | 20 | public ContentFlagBuilder(@NotNull String name, @NotNull ArgumentParser parser) { 21 | super(name); 22 | this.parser = parser; 23 | this.sample = ""; 24 | } 25 | 26 | @Override 27 | @NotNull 28 | protected ContentFlagBuilder getThis() { 29 | return this; 30 | } 31 | 32 | @NotNull 33 | public ContentFlagBuilder sample(@NotNull String sample) { 34 | this.sample = sample; 35 | return getThis(); 36 | } 37 | 38 | @Override 39 | public @NotNull ContentFlag build() { 40 | return new ContentFlag<>(this.name, this.parser, this.sample, this.permission); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/event/MenuOpenEvent.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.event; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.event.Cancellable; 5 | import org.bukkit.event.Event; 6 | import org.bukkit.event.HandlerList; 7 | import org.jetbrains.annotations.NotNull; 8 | import su.nightexpress.nightcore.ui.menu.Menu; 9 | 10 | public class MenuOpenEvent extends Event implements Cancellable { 11 | 12 | public static final HandlerList HANDLER_LIST = new HandlerList(); 13 | 14 | private final Player player; 15 | private final Menu menu; 16 | 17 | private boolean cancelled; 18 | 19 | public MenuOpenEvent(@NotNull Player player, @NotNull Menu menu) { 20 | this.player = player; 21 | this.menu = menu; 22 | } 23 | 24 | @NotNull 25 | @Override 26 | public HandlerList getHandlers() { 27 | return HANDLER_LIST; 28 | } 29 | 30 | public static HandlerList getHandlerList() { 31 | return HANDLER_LIST; 32 | } 33 | 34 | @NotNull 35 | public Player getPlayer() { 36 | return this.player; 37 | } 38 | 39 | @NotNull 40 | public Menu getMenu() { 41 | return this.menu; 42 | } 43 | 44 | @Override 45 | public boolean isCancelled() { 46 | return this.cancelled; 47 | } 48 | 49 | @Override 50 | public void setCancelled(boolean cancelled) { 51 | this.cancelled = cancelled; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/api/event/MenuOpenEvent.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.api.event; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.event.Cancellable; 5 | import org.bukkit.event.Event; 6 | import org.bukkit.event.HandlerList; 7 | import org.jetbrains.annotations.NotNull; 8 | import su.nightexpress.nightcore.ui.inventory.Menu; 9 | 10 | public class MenuOpenEvent extends Event implements Cancellable { 11 | 12 | private static final HandlerList HANDLER_LIST = new HandlerList(); 13 | 14 | private final Player player; 15 | private final Menu menu; 16 | 17 | private boolean cancelled; 18 | 19 | public MenuOpenEvent(@NotNull Player player, @NotNull Menu menu) { 20 | this.player = player; 21 | this.menu = menu; 22 | } 23 | 24 | @NotNull 25 | @Override 26 | public HandlerList getHandlers() { 27 | return HANDLER_LIST; 28 | } 29 | 30 | public static HandlerList getHandlerList() { 31 | return HANDLER_LIST; 32 | } 33 | 34 | @NotNull 35 | public Player getPlayer() { 36 | return this.player; 37 | } 38 | 39 | @NotNull 40 | public Menu getMenu() { 41 | return this.menu; 42 | } 43 | 44 | @Override 45 | public boolean isCancelled() { 46 | return this.cancelled; 47 | } 48 | 49 | @Override 50 | public void setCancelled(boolean cancelled) { 51 | this.cancelled = cancelled; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/event/PlayerOpenMenuEvent.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.api.event; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.event.Cancellable; 5 | import org.bukkit.event.Event; 6 | import org.bukkit.event.HandlerList; 7 | import org.jetbrains.annotations.NotNull; 8 | import su.nightexpress.nightcore.menu.api.Menu; 9 | 10 | @Deprecated 11 | public class PlayerOpenMenuEvent extends Event implements Cancellable { 12 | 13 | public static final HandlerList HANDLER_LIST = new HandlerList(); 14 | 15 | private final Player player; 16 | private final Menu menu; 17 | 18 | private boolean cancelled; 19 | 20 | public PlayerOpenMenuEvent(@NotNull Player player, @NotNull Menu menu) { 21 | this.player = player; 22 | this.menu = menu; 23 | } 24 | 25 | @NotNull 26 | @Override 27 | public HandlerList getHandlers() { 28 | return HANDLER_LIST; 29 | } 30 | 31 | public static HandlerList getHandlerList() { 32 | return HANDLER_LIST; 33 | } 34 | 35 | @NotNull 36 | public Player getPlayer() { 37 | return player; 38 | } 39 | 40 | @NotNull 41 | public Menu getMenu() { 42 | return menu; 43 | } 44 | 45 | @Override 46 | public boolean isCancelled() { 47 | return cancelled; 48 | } 49 | 50 | @Override 51 | public void setCancelled(boolean cancelled) { 52 | this.cancelled = cancelled; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/core/CorePerms.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.core; 2 | 3 | import su.nightexpress.nightcore.util.Placeholders; 4 | import su.nightexpress.nightcore.util.wrapper.UniPermission; 5 | 6 | public class CorePerms { 7 | 8 | public static final String PREFIX = "nightcore."; 9 | public static final String PREFIX_COMMAND = PREFIX + "command."; 10 | 11 | public static final UniPermission PLUGIN = new UniPermission(PREFIX + Placeholders.WILDCARD); 12 | public static final UniPermission COMMAND = new UniPermission(PREFIX_COMMAND + Placeholders.WILDCARD); 13 | 14 | public static final UniPermission COMMAND_RELOAD = new UniPermission(PREFIX_COMMAND + "reload"); 15 | public static final UniPermission COMMAND_CHECK_PERM = new UniPermission(PREFIX_COMMAND + "checkperm"); 16 | public static final UniPermission COMMAND_DUMP_ITEM = new UniPermission(PREFIX_COMMAND + "dumpitem"); 17 | public static final UniPermission COMMAND_ECONOMY_BRIDGE = new UniPermission(PREFIX_COMMAND + "economybridge"); 18 | 19 | @Deprecated 20 | public static final UniPermission COMMAND_FLAGS = new UniPermission("nightcore.command.flags"); 21 | 22 | static { 23 | PLUGIN.addChildren(COMMAND); 24 | 25 | COMMAND.addChildren( 26 | COMMAND_RELOAD, 27 | COMMAND_CHECK_PERM, 28 | COMMAND_DUMP_ITEM, 29 | COMMAND_ECONOMY_BRIDGE 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/db/sql/column/ColumnType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.db.sql.column; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.db.config.DatabaseType; 5 | 6 | public interface ColumnType { 7 | 8 | ColumnType STRING = (type, length) -> { 9 | if (length < 1 || type == DatabaseType.SQLITE) { 10 | return type == DatabaseType.SQLITE ? "TEXT NOT NULL" : "MEDIUMTEXT NOT NULL"; 11 | } 12 | return "varchar(" + length + ") CHARACTER SET utf8 NOT NULL"; 13 | }; 14 | 15 | ColumnType INTEGER = (type, length) -> { 16 | if (length < 1 || type == DatabaseType.SQLITE) { 17 | return "INTEGER NOT NULL"; 18 | } 19 | return "int(" + length + ") NOT NULL"; 20 | }; 21 | 22 | ColumnType DOUBLE = (type, length) -> { 23 | return type == DatabaseType.SQLITE ? "REAL NOT NULL" : "double NOT NULL"; 24 | }; 25 | 26 | ColumnType LONG = (type, length) -> { 27 | return length < 1 || type == DatabaseType.SQLITE ? "BIGINT NOT NULL" : "bigint(" + length + ") NOT NULL"; 28 | }; 29 | 30 | ColumnType TIMESTAMP = (type, length) -> { 31 | return "TIMESTAMP NOT NULL"; 32 | }; 33 | 34 | ColumnType BOOLEAN = (type, length) -> { 35 | return type == DatabaseType.SQLITE ? "INTEGER NOT NULL" : "tinyint(1) NOT NULL"; 36 | }; 37 | 38 | @NotNull String build(@NotNull DatabaseType type, int length); 39 | } 40 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/argument/type/WorldArgumentType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.argument.type; 2 | 3 | import org.bukkit.Bukkit; 4 | import org.bukkit.World; 5 | import org.jetbrains.annotations.NotNull; 6 | import su.nightexpress.nightcore.commands.SuggestionsProvider; 7 | import su.nightexpress.nightcore.commands.argument.ArgumentReader; 8 | import su.nightexpress.nightcore.commands.argument.ArgumentType; 9 | import su.nightexpress.nightcore.commands.context.CommandContext; 10 | import su.nightexpress.nightcore.commands.context.CommandContextBuilder; 11 | import su.nightexpress.nightcore.commands.exceptions.CommandSyntaxException; 12 | import su.nightexpress.nightcore.core.config.CoreLang; 13 | import su.nightexpress.nightcore.util.BukkitThing; 14 | 15 | import java.util.List; 16 | 17 | public class WorldArgumentType implements ArgumentType, SuggestionsProvider { 18 | 19 | @Override 20 | @NotNull 21 | public World parse(@NotNull CommandContextBuilder contextBuilder, @NotNull String string) throws CommandSyntaxException { 22 | World world = Bukkit.getWorld(string); 23 | if (world == null) throw CommandSyntaxException.custom(CoreLang.COMMAND_SYNTAX_INVALID_WORLD); 24 | 25 | return world; 26 | } 27 | 28 | @Override 29 | @NotNull 30 | public List suggest(@NotNull ArgumentReader reader, @NotNull CommandContext context) { 31 | return BukkitThing.worldNames(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/currency/type/IncompleteCurrency.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.currency.type; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.integration.currency.CurrencySettings; 6 | 7 | public abstract class IncompleteCurrency extends AbstractCurrency { 8 | 9 | protected CurrencySettings settings; 10 | 11 | public IncompleteCurrency(@NotNull String id) { 12 | super(id); 13 | } 14 | 15 | public IncompleteCurrency(@NotNull String originalId, @NotNull String internalId) { 16 | super(originalId, internalId); 17 | //this.setSettings(this.getDefaultSettings()); 18 | } 19 | 20 | @NotNull 21 | public abstract CurrencySettings getDefaultSettings(); 22 | 23 | @NotNull 24 | public CurrencySettings getSettings() { 25 | return this.settings; 26 | } 27 | 28 | public void setSettings(@NotNull CurrencySettings settings) { 29 | this.settings = settings; 30 | } 31 | 32 | @Override 33 | @NotNull 34 | public String getName() { 35 | return this.settings.getName(); 36 | } 37 | 38 | @Override 39 | @NotNull 40 | public String getFormat() { 41 | return this.settings.getFormat(); 42 | } 43 | 44 | @Override 45 | @NotNull 46 | public ItemStack getIcon() { 47 | return this.settings.getIcon().getItemStack(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/sql/column/ColumnFormer.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database.sql.column; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.database.DatabaseType; 5 | 6 | @Deprecated 7 | public interface ColumnFormer { 8 | 9 | ColumnFormer STRING = (storageType, length) -> { 10 | if (length < 1 || storageType == DatabaseType.SQLITE) { 11 | return storageType == DatabaseType.SQLITE ? "TEXT NOT NULL" : "MEDIUMTEXT NOT NULL"; 12 | } 13 | return "varchar(" + length + ") CHARACTER SET utf8 NOT NULL"; 14 | }; 15 | 16 | ColumnFormer INTEGER = (storageType, length) -> { 17 | if (length < 1 || storageType == DatabaseType.SQLITE) { 18 | return "INTEGER NOT NULL"; 19 | } 20 | return "int(" + length + ") NOT NULL"; 21 | }; 22 | 23 | ColumnFormer DOUBLE = (storageType, length) -> { 24 | return storageType == DatabaseType.SQLITE ? "REAL NOT NULL" : "double NOT NULL"; 25 | }; 26 | 27 | ColumnFormer LONG = (storageType, length) -> { 28 | return length < 1 || storageType == DatabaseType.SQLITE ? "BIGINT NOT NULL" : "bigint(" + length + ") NOT NULL"; 29 | }; 30 | 31 | ColumnFormer BOOLEAN = (storageType, length) -> { 32 | return storageType == DatabaseType.SQLITE ? "INTEGER NOT NULL" : "tinyint(1) NOT NULL"; 33 | }; 34 | 35 | @NotNull String build(@NotNull DatabaseType databaseType, int length); 36 | } 37 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/exceptions/CommandSyntaxException.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.exceptions; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.core.config.CoreLang; 6 | import su.nightexpress.nightcore.locale.entry.MessageLocale; 7 | 8 | public class CommandSyntaxException extends Exception { 9 | 10 | private final MessageLocale messageLocale; 11 | private final String value; 12 | 13 | public CommandSyntaxException(@NotNull MessageLocale messageLocale, @Nullable String value) { 14 | this.messageLocale = messageLocale; 15 | this.value = value; 16 | } 17 | 18 | @NotNull 19 | public static CommandSyntaxException generic() { 20 | return new CommandSyntaxException(CoreLang.COMMAND_SYNTAX_GENERIC_ERROR, null); 21 | } 22 | 23 | @NotNull 24 | public static CommandSyntaxException custom(@NotNull MessageLocale locale) { 25 | return new CommandSyntaxException(locale, null); 26 | } 27 | 28 | @NotNull 29 | public static CommandSyntaxException dynamic(@NotNull MessageLocale locale, @NotNull String value) { 30 | return new CommandSyntaxException(locale, value); 31 | } 32 | 33 | @NotNull 34 | public MessageLocale getMessageLocale() { 35 | return this.messageLocale; 36 | } 37 | 38 | @Nullable 39 | public String getValue() { 40 | return this.value; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/wrapper/SimpleTagWrapper.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.wrapper; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 5 | 6 | public class SimpleTagWrapper implements TagWrapper { 7 | 8 | private final String tag; 9 | private final String[] arguments; 10 | 11 | public SimpleTagWrapper(@NotNull String tag, String[] arguments) { 12 | this.tag = tag; 13 | this.arguments = arguments; 14 | } 15 | 16 | @NotNull 17 | public String opening() { 18 | return ParserUtils.OPEN_BRACKET + this.openingNoBrackets() + ParserUtils.CLOSE_BRACKET; 19 | } 20 | 21 | @NotNull 22 | public String openingNoBrackets() { 23 | StringBuilder builder = new StringBuilder(); 24 | builder.append(this.tag); 25 | if (this.arguments.length > 0) { 26 | builder.append(ParserUtils.DELIMITER); 27 | builder.append(String.join(String.valueOf(ParserUtils.DELIMITER), this.arguments)); 28 | } 29 | return builder.toString(); 30 | } 31 | 32 | @NotNull 33 | public String closing() { 34 | return String.valueOf(ParserUtils.OPEN_BRACKET) + ParserUtils.CLOSE_SLASH + this.tag + ParserUtils.CLOSE_BRACKET; 35 | } 36 | 37 | @Override 38 | @NotNull 39 | public String wrap(@NotNull String string) { 40 | return this.opening() + string + this.closing(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/builder/NodeBuilder.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.builder; 2 | 3 | import org.bukkit.permissions.Permission; 4 | import org.jetbrains.annotations.NotNull; 5 | import org.jetbrains.annotations.Nullable; 6 | import su.nightexpress.nightcore.commands.CommandRequirement; 7 | import su.nightexpress.nightcore.commands.tree.CommandNode; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public abstract class NodeBuilder> { 13 | 14 | protected String permission; 15 | protected List requirements; 16 | 17 | public NodeBuilder() { 18 | this.requirements = new ArrayList<>(); 19 | } 20 | 21 | @NotNull 22 | protected abstract T getThis(); 23 | 24 | @NotNull 25 | public abstract CommandNode build(); 26 | 27 | @NotNull 28 | public T permission(@Nullable Permission permission) { 29 | return this.permission(permission == null ? null : permission.getName()); 30 | } 31 | 32 | @NotNull 33 | public T permission(@Nullable String permission) { 34 | this.permission = permission; 35 | return this.getThis(); 36 | } 37 | 38 | @NotNull 39 | public T playerOnly() { 40 | return this.requires(CommandRequirement.playerOnly()); 41 | } 42 | 43 | @NotNull 44 | public T requires(@Nullable CommandRequirement requirement) { 45 | this.requirements.add(requirement); 46 | return this.getThis(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/argument/type/PlayerArgumentType.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.argument.type; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.commands.SuggestionsProvider; 6 | import su.nightexpress.nightcore.commands.argument.ArgumentReader; 7 | import su.nightexpress.nightcore.commands.argument.ArgumentType; 8 | import su.nightexpress.nightcore.commands.context.CommandContext; 9 | import su.nightexpress.nightcore.commands.context.CommandContextBuilder; 10 | import su.nightexpress.nightcore.commands.exceptions.CommandSyntaxException; 11 | import su.nightexpress.nightcore.core.config.CoreLang; 12 | import su.nightexpress.nightcore.util.Players; 13 | 14 | import java.util.List; 15 | 16 | public class PlayerArgumentType implements ArgumentType, SuggestionsProvider { 17 | 18 | @Override 19 | @NotNull 20 | public Player parse(@NotNull CommandContextBuilder contextBuilder, @NotNull String string) throws CommandSyntaxException { 21 | Player player = Players.getPlayer(string); 22 | if (player == null) throw CommandSyntaxException.custom(CoreLang.ERROR_INVALID_PLAYER); 23 | 24 | return player; 25 | } 26 | 27 | @Override 28 | @NotNull 29 | public List suggest(@NotNull ArgumentReader reader, @NotNull CommandContext context) { 30 | return context.getSender() instanceof Player player ? Players.playerNames(player) : Players.playerNames(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/item/adapter/impl/ItemsAdderAdapter.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.item.adapter.impl; 2 | 3 | import dev.lone.itemsadder.api.CustomStack; 4 | import org.bukkit.inventory.ItemStack; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | import su.nightexpress.nightcore.integration.item.data.ItemIdData; 8 | import su.nightexpress.nightcore.integration.item.adapter.IdentifiableItemAdapter; 9 | 10 | public class ItemsAdderAdapter extends IdentifiableItemAdapter { 11 | 12 | public ItemsAdderAdapter() { 13 | super("itemsadder"); 14 | } 15 | 16 | @Override 17 | @Nullable 18 | public ItemStack createItem(@NotNull String itemId) { 19 | CustomStack customStack = CustomStack.getInstance(itemId); 20 | return customStack == null ? null : customStack.getItemStack(); 21 | } 22 | 23 | @Override 24 | public boolean canHandle(@NotNull ItemStack itemStack) { 25 | return CustomStack.byItemStack(itemStack) != null; 26 | } 27 | 28 | @Override 29 | public boolean canHandle(@NotNull ItemIdData data) { 30 | return CustomStack.isInRegistry(data.getItemId()); 31 | } 32 | 33 | @Override 34 | @Nullable 35 | public String getItemId(@NotNull ItemStack item) { 36 | if (item.getType().isAir()) return null; 37 | 38 | CustomStack stack = CustomStack.byItemStack(item); 39 | return stack == null ? null : stack.getNamespacedID(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /spigot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | su.nightexpress.nightcore 8 | nightcore 9 | 2.11.0 10 | 11 | 12 | spigot 13 | 14 | 15 | 21 16 | 21 17 | UTF-8 18 | 19 | 20 | 21 | 22 | spigot-repo 23 | https://hub.spigotmc.org/nexus/content/repositories/snapshots/ 24 | 25 | 26 | 27 | 28 | 29 | org.spigotmc 30 | spigot-api 31 | 1.21.9-R0.1-SNAPSHOT 32 | provided 33 | 34 | 35 | 36 | su.nightexpress.nightcore 37 | bridge 38 | 2.11.0 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/ShadowTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.Numbers; 6 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 7 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 8 | import su.nightexpress.nightcore.util.text.night.tag.TagContent; 9 | 10 | import java.awt.*; 11 | 12 | public class ShadowTagHandler extends ClassicTagHandler { 13 | 14 | private static final float DEFAULT_ALPHA = 0.25f; 15 | private static final float MAX_ALPHA = 1f; 16 | 17 | @Override 18 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 19 | if (tagContent == null || tagContent.length() < 7) return; 20 | 21 | TagContent content = ParserUtils.parseInnerContent(tagContent); 22 | String alphaRaw = content.second(); 23 | 24 | Color color = ParserUtils.colorFromSchemeOrHex(tagContent); 25 | if (color == null) return; 26 | 27 | float[] rgb = color.getRGBColorComponents(null); 28 | float alpha = alphaRaw == null ? DEFAULT_ALPHA: Math.min(MAX_ALPHA, Numbers.getFloatAbs(alphaRaw)); 29 | 30 | group.setStyle(nightStyle -> nightStyle.shadowColor(new Color(rgb[0], rgb[1], rgb[2], alpha))); 31 | } 32 | 33 | @Override 34 | protected void onHandleClose(@NotNull EntryGroup group) { 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/NightCoreLoader.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore; 2 | 3 | import io.papermc.paper.plugin.loader.PluginClasspathBuilder; 4 | import io.papermc.paper.plugin.loader.PluginLoader; 5 | import io.papermc.paper.plugin.loader.library.impl.MavenLibraryResolver; 6 | import org.eclipse.aether.artifact.DefaultArtifact; 7 | import org.eclipse.aether.graph.Dependency; 8 | import org.eclipse.aether.repository.RemoteRepository; 9 | import org.jetbrains.annotations.NotNull; 10 | 11 | public class NightCoreLoader implements PluginLoader { 12 | 13 | @Override 14 | public void classloader(@NotNull PluginClasspathBuilder classpathBuilder) { 15 | MavenLibraryResolver resolver = new MavenLibraryResolver(); 16 | 17 | try { 18 | resolver.addRepository(new RemoteRepository.Builder("maven", "default", MavenLibraryResolver.MAVEN_CENTRAL_DEFAULT_MIRROR).build()); 19 | } 20 | catch (NoSuchFieldError error) { 21 | resolver.addRepository(new RemoteRepository.Builder("maven", "default", "https://maven-central.storage-download.googleapis.com/maven2").build()); 22 | } 23 | 24 | //resolver.addDependency(new Dependency(new DefaultArtifact("org.xerial:sqlite-jdbc:3.49.1.0"), null)); 25 | resolver.addDependency(new Dependency(new DefaultArtifact("com.zaxxer:HikariCP:6.0.0"), null)); 26 | resolver.addDependency(new Dependency(new DefaultArtifact("it.unimi.dsi:fastutil-core:8.5.13"), null)); 27 | 28 | classpathBuilder.addLibrary(resolver); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/util/text/night/tag/handler/LangTagHandler.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text.night.tag.handler; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.util.text.night.ParserUtils; 6 | import su.nightexpress.nightcore.util.text.night.entry.EntryGroup; 7 | 8 | public class LangTagHandler extends ClassicTagHandler { 9 | 10 | // TODO Arguments 11 | 12 | @Override 13 | protected void onHandleOpen(@NotNull EntryGroup group, @Nullable String tagContent) { 14 | if (tagContent == null) return; 15 | 16 | String content = fixContent(tagContent); 17 | 18 | int index = ParserUtils.findUnescapedUnquotedChar(content, ParserUtils.DELIMITER, 0); 19 | String key = ParserUtils.unquoted(index < 0 ? content : content.substring(0, index)); 20 | String fallback = index < 0 || index >= content.length() ? null : ParserUtils.unquoted(content.substring(index + 1)); 21 | 22 | group.appendLangEntry(key, fallback); 23 | } 24 | 25 | @NotNull 26 | private static String fixContent(@NotNull String tagContent) { 27 | if (tagContent.endsWith("/")) return tagContent.substring(0, tagContent.length() - 1); // MiniMessage#serialize fix. 28 | 29 | return tagContent; 30 | } 31 | 32 | @Override 33 | protected void onHandleClose(@NotNull EntryGroup group) { 34 | 35 | } 36 | 37 | @Override 38 | public boolean canBeClosed() { 39 | return false; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/core/listener/CoreListener.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.core.listener; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.event.EventHandler; 5 | import org.bukkit.event.EventPriority; 6 | import org.bukkit.event.player.PlayerJoinEvent; 7 | import org.jetbrains.annotations.NotNull; 8 | import su.nightexpress.nightcore.NightCore; 9 | import su.nightexpress.nightcore.core.CoreConfig; 10 | import su.nightexpress.nightcore.manager.AbstractListener; 11 | import su.nightexpress.nightcore.util.Version; 12 | import su.nightexpress.nightcore.util.bridge.Software; 13 | import su.nightexpress.nightcore.util.profile.CachedProfile; 14 | import su.nightexpress.nightcore.util.profile.PlayerProfiles; 15 | 16 | public class CoreListener extends AbstractListener { 17 | 18 | public CoreListener(@NotNull NightCore plugin) { 19 | super(plugin); 20 | } 21 | 22 | @EventHandler(priority = EventPriority.LOWEST) 23 | public void onPlayerJoin(PlayerJoinEvent event) { 24 | if (!CoreConfig.PROFILE_UPDATE_ON_JOIN.get()) return; 25 | 26 | Player player = event.getPlayer(); 27 | CachedProfile profile = PlayerProfiles.getProfile(player); 28 | if (Version.isSpigot()) { 29 | profile.update(); // "If the player is online, the returned profile will be complete." yeah yeah sure 30 | } 31 | else { 32 | profile.update(Software.get().getProfile(player)); // Thanks paper for ACTUALLY complete profiles of online players. 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/dialog/build/DialogActions.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.dialog.build; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.bridge.common.NightNbtHolder; 6 | import su.nightexpress.nightcore.bridge.dialog.wrap.action.WrappedDialogCommandTemplateAction; 7 | import su.nightexpress.nightcore.bridge.dialog.wrap.action.WrappedDialogCustomAction; 8 | import su.nightexpress.nightcore.bridge.dialog.wrap.action.WrappedDialogStaticAction; 9 | import su.nightexpress.nightcore.bridge.text.event.NightClickEvent; 10 | 11 | public class DialogActions { 12 | 13 | public static final String OK = "ok"; 14 | public static final String CANCEL = "cancel"; 15 | public static final String BACK = "back"; 16 | 17 | @NotNull 18 | public static WrappedDialogStaticAction staticAction(@NotNull NightClickEvent event) { 19 | return new WrappedDialogStaticAction(event); 20 | } 21 | 22 | @NotNull 23 | public static WrappedDialogCommandTemplateAction commandTemplate(@NotNull String template) { 24 | return new WrappedDialogCommandTemplateAction(template); 25 | } 26 | 27 | @NotNull 28 | public static WrappedDialogCustomAction customClick(@NotNull String id) { 29 | return customClick(id, null); 30 | } 31 | 32 | @NotNull 33 | public static WrappedDialogCustomAction customClick(@NotNull String id, @Nullable NightNbtHolder nbt) { 34 | return new WrappedDialogCustomAction(id, nbt); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /utils/src/main/java/su/nightexpress/nightcore/util/Enums.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | import java.util.Comparator; 7 | import java.util.List; 8 | import java.util.Optional; 9 | import java.util.stream.Stream; 10 | 11 | public class Enums { 12 | 13 | private static final String DEFAULT_DELIMITER = ", "; 14 | 15 | @NotNull 16 | public static > Optional parse(String str, @NotNull Class clazz) { 17 | try { 18 | return str == null ? Optional.empty() : Optional.of(Enum.valueOf(clazz, str.toUpperCase())); 19 | } 20 | catch (Exception exception) { 21 | return Optional.empty(); 22 | } 23 | } 24 | 25 | @Nullable 26 | public static > T get(String str, @NotNull Class clazz) { 27 | return parse(str, clazz).orElse(null); 28 | } 29 | 30 | @NotNull 31 | public static String inline(@NotNull Class> clazz) { 32 | return inline(clazz, DEFAULT_DELIMITER); 33 | } 34 | 35 | @NotNull 36 | public static String inline(@NotNull Class> clazz, @NotNull String delimiter) { 37 | return String.join(delimiter, Enums.getNames(clazz)); 38 | } 39 | 40 | @NotNull 41 | public static List getNames(@NotNull Class> clazz) { 42 | return Stream.of(clazz.getEnumConstants()).sorted(Comparator.comparingInt(Enum::ordinal)).map(Object::toString).toList(); 43 | } 44 | } 45 | --------------------------------------------------------------------------------

implements SimpeListener { 7 | 8 | @NotNull 9 | public final P plugin; 10 | 11 | public AbstractListener(@NotNull P plugin) { 12 | this.plugin = plugin; 13 | } 14 | 15 | @Override 16 | public void registerListeners() { 17 | this.plugin.getPluginManager().registerEvents(this, this.plugin); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/integration/currency/CurrencyPlugins.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.integration.currency; 2 | 3 | public class CurrencyPlugins { 4 | 5 | public static final String VAULT = "Vault"; 6 | public static final String PLAYER_POINTS = "PlayerPoints"; 7 | public static final String COINS_ENGINE = "CoinsEngine"; 8 | public static final String ULTRA_ECONOMY = "UltraEconomy"; 9 | public static final String BEAST_TOKENS = "BeastTokens"; 10 | public static final String VOTING_PLUGIN = "VotingPlugin"; 11 | public static final String ELITEMOBS = "EliteMobs"; 12 | } 13 | -------------------------------------------------------------------------------- /utils/src/main/java/su/nightexpress/nightcore/util/ServerUtils.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util; 2 | 3 | import org.bukkit.Bukkit; 4 | import org.bukkit.plugin.RegisteredServiceProvider; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.Optional; 8 | 9 | public class ServerUtils { 10 | 11 | @NotNull 12 | public static Optional serviceProvider(@NotNull Class type) { 13 | RegisteredServiceProvider provider = Bukkit.getServer().getServicesManager().getRegistration(type); 14 | return provider == null ? Optional.empty() : Optional.of(provider.getProvider()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/text/TextChildren.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.text; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.util.bridge.wrapper.ComponentBuildable; 5 | 6 | @Deprecated 7 | public abstract class TextChildren implements ComponentBuildable { 8 | 9 | protected final TextGroup parent; 10 | 11 | public TextChildren(@NotNull TextGroup parent) { 12 | this.parent = parent; 13 | } 14 | 15 | @NotNull 16 | public TextGroup getParent() { 17 | return this.parent; 18 | } 19 | 20 | public abstract int textLength(); 21 | } 22 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/action/WrappedDialogStaticAction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.action; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogActionAdapter; 5 | import su.nightexpress.nightcore.bridge.text.event.NightClickEvent; 6 | 7 | public record WrappedDialogStaticAction(@NotNull NightClickEvent clickEvent) implements WrappedDialogAction { 8 | 9 | @Override 10 | @NotNull 11 | public A adapt(@NotNull DialogActionAdapter adapter) { 12 | return adapter.adaptAction(this); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/manager/FileBacked.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.manager; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.io.File; 6 | import java.nio.file.Path; 7 | 8 | public interface FileBacked { 9 | 10 | /** 11 | * Gets the file associated with the given object. 12 | * @return the file. 13 | */ 14 | @Deprecated 15 | @NotNull default File getFile() { 16 | return this.getPath().toFile(); 17 | } 18 | 19 | /** 20 | * Gets the file associated with the given object. 21 | * @return the file. 22 | */ 23 | @NotNull Path getPath(); 24 | } 25 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/database/sql/SQLExecutor.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.database.sql; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.database.AbstractConnector; 5 | 6 | @Deprecated 7 | public abstract class SQLExecutor { 8 | 9 | protected final String table; 10 | 11 | protected SQLExecutor(@NotNull String table) { 12 | this.table = table; 13 | } 14 | 15 | @NotNull 16 | public String getTable() { 17 | return "`" + this.table + "`"; 18 | } 19 | 20 | @NotNull 21 | public abstract T execute(@NotNull AbstractConnector connector); 22 | } 23 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/language/tag/impl/NoPrefixTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.language.tag.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.language.message.MessageOptions; 6 | import su.nightexpress.nightcore.language.tag.MessageTag; 7 | 8 | @Deprecated 9 | public class NoPrefixTag extends MessageTag { 10 | 11 | public NoPrefixTag() { 12 | super("noprefix"); 13 | } 14 | 15 | @Override 16 | public void apply(@NotNull MessageOptions options, @Nullable String tagContent) { 17 | options.setHasPrefix(false); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/experimental/flag/SimpleFlag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.experimental.flag; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.command.experimental.builder.SimpleFlagBuilder; 6 | 7 | @Deprecated 8 | public class SimpleFlag extends CommandFlag { 9 | 10 | public SimpleFlag(@NotNull String name, @Nullable String permission) { 11 | super(name, permission); 12 | } 13 | 14 | @NotNull 15 | public static SimpleFlagBuilder builder(@NotNull String name) { 16 | return new SimpleFlagBuilder(name); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/context/Suggestions.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.context; 2 | 3 | 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | public class Suggestions { 10 | 11 | public List suggestions; 12 | 13 | public Suggestions() { 14 | this.suggestions = new ArrayList<>(); 15 | } 16 | 17 | @NotNull 18 | public List getSuggestions() { 19 | return this.suggestions; 20 | } 21 | 22 | public void setSuggestions(@NotNull List suggestions) { 23 | this.suggestions = suggestions; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/language/tag/impl/PlaceholderTag.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.language.tag.impl; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.language.message.MessageOptions; 6 | import su.nightexpress.nightcore.language.tag.MessageTag; 7 | 8 | @Deprecated 9 | public class PlaceholderTag extends MessageTag { 10 | 11 | public PlaceholderTag() { 12 | super("papi"); 13 | } 14 | 15 | @Override 16 | public void apply(@NotNull MessageOptions options, @Nullable String tagContent) { 17 | options.setUsePlaceholderAPI(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/impl/BaseCommand.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.impl; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.jetbrains.annotations.NotNull; 5 | import su.nightexpress.nightcore.NightCorePlugin; 6 | import su.nightexpress.nightcore.command.CommandResult; 7 | 8 | @Deprecated 9 | public class BaseCommand extends PluginCommand { 10 | 11 | public BaseCommand(@NotNull NightCorePlugin plugin) { 12 | super(plugin, plugin.getCommandAliases()); 13 | } 14 | 15 | @Override 16 | protected void onExecute(@NotNull CommandSender sender, @NotNull CommandResult result) { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/util/regex/MatcherTimeoutException.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util.regex; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | public class MatcherTimeoutException extends RuntimeException { 6 | 7 | private final String chars; 8 | private final long timeout; 9 | 10 | MatcherTimeoutException(@NotNull CharSequence chars, long timeout) { 11 | this.chars = chars.toString(); 12 | this.timeout = timeout; 13 | } 14 | 15 | @NotNull 16 | public String getString() { 17 | return this.chars; 18 | } 19 | 20 | public long getTimeout() { 21 | return this.timeout; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/command/api/NightPluginCommand.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.command.api; 2 | 3 | import org.bukkit.command.Command; 4 | import org.bukkit.command.TabExecutor; 5 | import org.jetbrains.annotations.NotNull; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | @Deprecated 9 | public interface NightPluginCommand extends NightCommand, TabExecutor { 10 | 11 | @Nullable NightCommand getDefaultCommand(); 12 | 13 | void addDefaultCommand(@NotNull NightCommand command); 14 | 15 | Command getBackend(); 16 | 17 | void setBackend(@NotNull Command backend); 18 | 19 | //@NotNull NightCommand findChildren(@NotNull String[] args); 20 | } 21 | -------------------------------------------------------------------------------- /bridge/src/main/java/su/nightexpress/nightcore/bridge/dialog/wrap/action/WrappedDialogCustomAction.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.bridge.dialog.wrap.action; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | import su.nightexpress.nightcore.bridge.common.NightNbtHolder; 6 | import su.nightexpress.nightcore.bridge.dialog.adapter.DialogActionAdapter; 7 | 8 | public record WrappedDialogCustomAction(@NotNull String id, @Nullable NightNbtHolder nbt) implements WrappedDialogAction { 9 | 10 | @Override 11 | @NotNull 12 | public A adapt(@NotNull DialogActionAdapter adapter) { 13 | return adapter.adaptAction(this); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/inventory/menu/AbstractMenu.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.inventory.menu; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.inventory.MenuType; 5 | import org.jetbrains.annotations.NotNull; 6 | import su.nightexpress.nightcore.NightPlugin; 7 | 8 | public abstract class AbstractMenu extends AbstractMenuBase { 9 | 10 | public AbstractMenu(@NotNull MenuType defaultType, @NotNull String defaultTitle) { 11 | super(defaultType, defaultTitle); 12 | } 13 | 14 | public boolean show(@NotNull NightPlugin plugin, @NotNull Player player) { 15 | return this.showMenu(plugin.getMenuRegistry(), player, null); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /utils/src/main/java/su/nightexpress/nightcore/util/LowerCase.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.util; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | 5 | import java.util.Locale; 6 | import java.util.function.Function; 7 | 8 | public enum LowerCase { 9 | 10 | INTERNAL(str -> str.toLowerCase(Locale.ROOT)), 11 | USER_LOCALE(str -> str.toLowerCase(Locale.getDefault())); 12 | 13 | private final Function function; 14 | 15 | LowerCase(@NotNull Function function) { 16 | this.function = function; 17 | } 18 | 19 | @NotNull 20 | public String apply(@NotNull String string) { 21 | return this.function.apply(string); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/commands/context/ParsedCommandNode.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.commands.context; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import su.nightexpress.nightcore.commands.tree.CommandNode; 5 | 6 | public class ParsedCommandNode { 7 | 8 | private final CommandNode node; 9 | private final int cursor; 10 | 11 | public ParsedCommandNode(@NotNull CommandNode node, int cursor) { 12 | this.node = node; 13 | this.cursor = cursor; 14 | } 15 | 16 | @NotNull 17 | public CommandNode getNode() { 18 | return this.node; 19 | } 20 | 21 | public int getCursor() { 22 | return this.cursor; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /main/src/main/java/su/nightexpress/nightcore/ui/menu/type/NormalMenu.java: -------------------------------------------------------------------------------- 1 | package su.nightexpress.nightcore.ui.menu.type; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.inventory.MenuType; 5 | import org.jetbrains.annotations.NotNull; 6 | import su.nightexpress.nightcore.NightPlugin; 7 | 8 | @SuppressWarnings("UnstableApiUsage") 9 | public abstract class NormalMenu