{"id":14969450,"url":"https://github.com/mockbukkit/mockbukkit","last_synced_at":"2025-05-14T13:05:42.598Z","repository":{"id":36953881,"uuid":"113238879","full_name":"MockBukkit/MockBukkit","owner":"MockBukkit","description":"MockBukkit is a mocking framework for Bukkit/PaperMC to allow the easy unit testing of Bukkit plugins.","archived":false,"fork":false,"pushed_at":"2025-05-04T19:41:59.000Z","size":11568,"stargazers_count":661,"open_issues_count":38,"forks_count":142,"subscribers_count":8,"default_branch":"v1.21","last_synced_at":"2025-05-04T20:21:15.463Z","etag":null,"topics":["bukkit","bukkit-plugins","hacktoberfest","mock-plugin","mockbukkit","mocking-framework","paper","paperm","papermc-plugin","spigot","spigotmc","testing","unit-testing"],"latest_commit_sha":null,"homepage":"https://mockbukkit.org/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MockBukkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-12-05T22:16:02.000Z","updated_at":"2025-05-04T19:39:28.000Z","dependencies_parsed_at":"2024-02-27T10:03:49.245Z","dependency_job_id":"2cf30e38-06d4-4d44-b586-909bc416b30c","html_url":"https://github.com/MockBukkit/MockBukkit","commit_stats":{"total_commits":2813,"total_committers":104,"mean_commits":"27.048076923076923","dds":0.6697476004265908,"last_synced_commit":"7b050591d1a848f80c54383f7b1acd098a7b012f"},"previous_names":[],"tags_count":555,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MockBukkit%2FMockBukkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MockBukkit%2FMockBukkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MockBukkit%2FMockBukkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MockBukkit%2FMockBukkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MockBukkit","download_url":"https://codeload.github.com/MockBukkit/MockBukkit/tar.gz/refs/heads/v1.21","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149949,"owners_count":22022851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bukkit","bukkit-plugins","hacktoberfest","mock-plugin","mockbukkit","mocking-framework","paper","paperm","papermc-plugin","spigot","spigotmc","testing","unit-testing"],"created_at":"2024-09-24T13:41:52.757Z","updated_at":"2025-05-14T13:05:42.565Z","avatar_url":"https://github.com/MockBukkit.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003c!-- Badges --\u003e\n    \u003ca href=\"https://github.com/MockBukkit/MockBukkit/actions/\"\u003e\n        \u003cimg alt=\"Build Status\" src=\"https://github.com/MockBukkit/MockBukkit/actions/workflows/publish.yml/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://search.maven.org/search?q=mockbukkit\"\u003e\n        \u003cimg alt=\"Maven Central\" src=\"https://img.shields.io/maven-central/v/org.mockbukkit.mockbukkit/mockbukkit-v1.21?color=1bcc94\u0026logo=apache-maven\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://javadoc.io/doc/org.mockbukkit.mockbukkit/mockbukkit-v1.21\"\u003e\n        \u003cimg alt=\"Javadocs\" src=\"https://javadoc.io/badge2/org.mockbukkit.mockbukkit/mockbukkit-v1.21/javadoc.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://sonarcloud.io/project/issues?resolved=false\u0026types=CODE_SMELL\u0026id=MockBukkit_MockBukkit\"\u003e\n        \u003cimg alt=\"Code Smells\" src=\"https://sonarcloud.io/api/project_badges/measure?project=MockBukkit_MockBukkit\u0026metric=code_smells\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://sonarcloud.io/component_measures?id=MockBukkit_MockBukkit\u0026metric=sqale_rating\u0026view=list\"\u003e\n        \u003cimg alt=\"Maintainability\" src=\"https://sonarcloud.io/api/project_badges/measure?project=MockBukkit_MockBukkit\u0026metric=sqale_rating\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://sonarcloud.io/project/issues?resolved=false\u0026types=BUG\u0026id=MockBukkit_MockBukkit\"\u003e\n        \u003cimg alt=\"Bugs\" src=\"https://sonarcloud.io/api/project_badges/measure?project=MockBukkit_MockBukkit\u0026metric=bugs\"\u003e\n    \u003c/a\u003e\n    \u003c!-- Logo --\u003e\n    \u003chr /\u003e\n        \u003cimg alt=\"MockBukkit logo (design by HuffleAnimations)\" title=\"Design by HuffleAnimations\" src=\"logo.png\"/\u003e\n    \u003chr /\u003e\n\u003c/p\u003e\n\nMockBukkit is a framework that makes the unit testing of Bukkit plugins a whole lot easier.\nIt aims to be provide complete mock implementation of CraftBukkit that can be completely controlled from a unit test.\n\n## :page_facing_up: Table of contents\n\n1. [Usage](#mag-usage)\n    - [Adding MockBukkit via gradle](#adding-mockbukkit-via-gradle)\n    - [Adding MockBukkit via Maven](#adding-mockbukkit-via-maven)\n    - [Using MockBukkit](#using-mockbukkit)\n2. [Features](#sparkles-features)\n    - [Mock Plugins](#mock-plugins)\n    - [Mock Players](#mock-players)\n    - [Mock Worlds](#mock-worlds)\n3. [Troubleshooting (My tests are being skipped)](#question-my-tests-are-being-skipped-unimplementedoperationexception)\n4. [Discord server](#headphones-discord-server)\n5. [Examples (See MockBukkit in action)](#tada-examples-see-mockbukkit-in-action)\n\n## :mag: Usage\n\nMockBukkit can easily be included in your project using either Maven or gradle.\n\n\u003e [!TIP]\n\u003e Currently, the newest version available is\n\u003e\n\u003e [![ALTERNATE-TEXT](https://img.shields.io/maven-central/v/org.mockbukkit.mockbukkit/mockbukkit-v1.21?color=1bcc94\u0026logo=apache-maven)](https://search.maven.org/search?q=MockBukkit)\n\n\n\u003e Note: The Breaking Changes intended for 3.0 were already made in 2.145.1. Due to an Error it didn't get properly tagged\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003eAdding MockBukkit via Gradle\u003c/h3\u003e\u003c/summary\u003e\n\nMockBukkit can easily be included in Gradle using the Maven Central and PaperMC repositories.\nMake sure to update the version as necessary.\n\n\n```gradle\nrepositories {\n    mavenCentral()\n    maven { url 'https://repo.papermc.io/repository/maven-public/' }\n}\n\ndependencies {\n    testImplementation 'org.mockbukkit.mockbukkit:mockbukkit-v1.21:[version]'\n}\n```\n\nIf you prefer to always have the latest Git version or need a specific commit/branch, you can always\nuse [JitPack](https://jitpack.io/#MockBukkit/MockBukkit) as your maven repository:\n\n```gradle\nrepositories {\n    maven { url 'https://jitpack.io' }\n    maven { url 'https://repo.papermc.io/repository/maven-public/' }\n}\n\ndependencies {\n    testImplementation 'com.github.MockBukkit:MockBukkit:v1.21-SNAPSHOT'\n}\n```\n\nNote: use `v1.13-SNAPSHOT` to test a Bukkit 1.13 plugin or any other version if\nthe [branch](https://github.com/MockBukkit/MockBukkit/branches) exists.\nThese branches will not be receiving patches actively, but any issues will be resolved and any pull requests on them\nwill be accepted.\nThis is because back-porting every single patch on every branch is incredibly time-consuming and slows down the\ndevelopment of MockBukkit.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ch3\u003eAdding MockBukkit via Maven\u003c/h3\u003e\u003c/summary\u003e\n\nMockBukkit can easily be included in Maven using the default Maven Central and PaperMC repositories.\n\u003e Note: Make sure to update the version as necessary and put this dependency above your dependency that provides bukkit.\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003epapermc\u003c/id\u003e\n        \u003curl\u003ehttps://repo.papermc.io/repository/maven-public/\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eorg.mockbukkit.mockbukkit\u003c/groupId\u003e\n    \u003cartifactId\u003emockbukkit-v1.21\u003c/artifactId\u003e\n    \u003cversion\u003e[version]\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nThe `test` scope is important here since you are likely to only be using MockBukkit during the `test` stage of your\nMaven lifecycle and not in your final product. \n\nIf you prefer to always have the latest Git version or need a specific commit/branch, you can always\nuse [JitPack](https://jitpack.io/#MockBukkit/MockBukkit) as your maven repository:\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack.io\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n    \u003crepository\u003e\n        \u003cid\u003epapermc\u003c/id\u003e\n        \u003curl\u003ehttps://repo.papermc.io/repository/maven-public/\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.MockBukkit\u003c/groupId\u003e\n    \u003cartifactId\u003eMockBukkit\u003c/artifactId\u003e\n    \u003cversion\u003ev1.21-SNAPSHOT\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n  \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nNote: use `v1.13-SNAPSHOT` to test a Bukkit 1.13 plugin or any other version if\nthe [branch](https://github.com/MockBukkit/MockBukkit/branches) exists.\nThese branches will not be receiving patches actively, but any issues will be resolved and any pull requests on them\nwill be accepted.\nThis is because back-porting every single patch on every branch is incredibly time-consuming and slows down the\ndevelopment of MockBukkit.\n\n\u003c/details\u003e\n\n### Using MockBukkit\n\nA plugin can be loaded in this initialiser block.\n\n```java\nprivate ServerMock server;\nprivate MyPlugin plugin;\n\n@BeforeEach\npublic void setUp()\n{\n    server = MockBukkit.mock();\n    plugin = MockBukkit.load(MyPlugin.class);\n}\n\n@AfterEach\npublic void tearDown()\n{\n    MockBukkit.unmock();\n}\n```\n\n## :sparkles: Features\n\n### Mock Plugins\n\nMockBukkit contains several functions that make the unit testing of Bukkit plugins a lot easier.\n\nIt is possible to create a mock plugin.\nThis is useful when the plugin you are testing may be looking at other loaded plugins.\nThe following piece of code creates a placeholder plugin that extends JavaPlugin.\n\n```java\nPluginMock plugin = MockBukkit.createMockPlugin();\n```\n\n### Mock Players\n\nMockBukkit makes it easy to create several mock players to use in unit testing.\nBy running ```server.setPlayers(int numberOfPlayers)``` one can set the number of online players.\nFrom then on it's possible to get a certain player using ```server.getPlayer(int i)```.\n\nAn even easier way to create a player on the fly is by simply using\n\n```java\nPlayerMock player = server.addPlayer();\n```\n\nA mock player also supports several simulated actions, such as damaging a block or even\nbreaking it. This will fire all the required events and will remove the block if the\nevents weren't cancelled.\n\n```java\nBlock block = ...;\nplayer.simulateBlockBreak(block);\n```\n\n### Mock Worlds\n\nAnother feature is the easy creation of mock worlds.\nOne can make a superflat world using one simple command:\n\n```java\nWorld world = new WorldMock(Material material, int heightUntilAir)\n```\n\nUsing `Material.DIRT` and 3 as heightUntilAir will create a superflat world with a height of a 128.\nAt y=0 everything will be `Material.BEDROCK`, and from 1 until 3 (inclusive) will be `Material.DIRT`\nand everything else will be `Material.AIR`.\nEach block is created the moment it is first accessed, so if only one block is only ever touched only one\nblock will ever be created in-memory.\n\n## :question: My tests are being skipped!? (UnimplementedOperationException)\n\nSometimes your code may use a method that is not yet implemented in MockBukkit.\nWhen this happens MockBukkit will, instead of returning placeholder values, throw\nan `UnimplementedOperationException`.\nThese exception extends `AssumptionException` and will cause the test to be skipped.\n\nThese exceptions should just be ignored, though pull requests that add functionality to MockBukkit are always welcome!\nIf you don't want to add the required methods yourself you can also request the method on the issues page.\n\n## :headphones: Discord Server\n\nYou can also find us on discord by the way!\nIf you need any help with MockBukkit or have a question regarding this project, feel free to join and connect with other\nmembers of the community.\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://discord.gg/s4cWYgsFaV\"\u003e\n    \u003cimg src=\"https://discordapp.com/api/guilds/792754410576019477/widget.png?style=banner3\" alt=\"Discord Invite\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## :tada: Examples (See MockBukkit in action)\n\nSeveral projects have utilized MockBukkit for their needs already.\nIf you want to see some projects that are using MockBukkit right now, feel free to take a peak:\n\n- [Slimefun/Slimefun4](https://github.com/Slimefun/Slimefun4/tree/master/src/test/java/io/github/thebusybiscuit/slimefun4)\n  (1700+ Unit Tests)\n- [Insprill/custom-join-messages](https://github.com/Insprill/custom-join-messages/tree/master/src/test/kotlin/net/insprill/cjm)\n  (170+ Unit Tests)\n- [carelesshippo/SpectatorModeRewrite](https://github.com/carelesshippo/SpectatorModeRewrite/tree/dev/src/test/java/me/ohowe12/spectatormode)\n  (80+ Unit Tests)\n- [lluiscamino/MultiverseHardcore](https://github.com/lluiscamino/MultiverseHardcore/tree/master/src/test/java/me/lluiscamino/multiversehardcore)\n  (75+ Unit Tests)\n- [axelrindle/PocketKnife](https://github.com/axelrindle/PocketKnife/tree/main/api/src/test/kotlin)\n  (50+ Unit Tests)\n- *and more! (If you want to see your plugin here, open up an issue and we'll consider adding it)*\n\nYou can also have a look at our documentation where we outline various examples and tricks on how to use MockBukkit\nalready:\nhttps://docs.mockbukkit.org\n\n## :gift_heart: Sponsors\n\nThanks to JetBrains, the creators of IntelliJ IDEA, for providing us with licenses as part of their [Open Source program](https://www.jetbrains.com/opensource/).  \n[![JetBrains](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/opensource/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmockbukkit%2Fmockbukkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmockbukkit%2Fmockbukkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmockbukkit%2Fmockbukkit/lists"}