Commit Graph

40 Commits

Author SHA1 Message Date
Alexander Medvedev
995edfb3c2 Add Effects 2025-02-22 14:17:06 +01:00
Alexander Medvedev
e2dff9d55a CI: Check for typos 2025-02-12 16:19:26 +01:00
Alexander Medvedev
06334ec658 Add Particle command 2025-02-11 20:43:16 +01:00
vyPal
af0573d9b8 Support Teleport to different world (#532)
* make entity world RwLock

* Add teleport function

* Mark client as not loaded before change dim

* clippy

* Post-merge issues

* FIx post merge issues

* Make world.remove_player fire event conditionally

* Remove extra StartWaitingChunks packet

* Add world.send_world_info()
2025-02-11 17:08:11 +01:00
Alexander Medvedev
8a5a0cdee8 Drop item when destroying blocks
Also make EntityType consts
2025-02-07 21:20:03 +01:00
drakeerv
0f88e79f8f Add basic weather, weather command, and weather cycle (#527)
* Add weather and weather command

I still need to add duration, fading and sounds

* F*ck bedrock

* Add weather cycle, fading, and duration

* Revert "Merge remote-tracking branch 'upstream/master' into weather"

This reverts commit c009fdfad3, reversing
changes made to ddeda07272.

* Reapply "Merge remote-tracking branch 'upstream/master' into weather"

This reverts commit 70a0e9861d.

* Update time.rs to use time arg
2025-02-05 18:59:53 +01:00
drakeerv
09d6eb6da2 Add damage types & damage command (#526) 2025-02-02 11:22:49 +01:00
Alexander Medvedev
466d4380cf Some Refactors 2025-02-01 17:53:41 +01:00
drakeerv
97065617b6 Implement experience and experiene/xp commands (#521)
* Initial experience support

For some reason I am getting link errors

* Implement experience math

* Fix packet and format/clippy

* Fix translate strings

* Fix experience handling

* Clippy & Format

* Fix experience calculations

* Fix how we store experience.

Math WIP

* Redo all experience calculations

This should be 100% vanilla parity.
2025-02-01 16:23:43 +01:00
MrMelther
136254729f Command parity to vanilla (#505)
* Updated show_entity

Changed a little bit the show_entity function from HoverEvents to better usability

* Added to_string to EntityType

Added to_str and to_string functions to allow proper use of identifiers in the show_entity of a TextComponent.

* Clear texts parity

Added translations to clear command, also added to show the player which items are cleaned, and tell something to the user like vanilla.

* Pumpkin command format

Formatted the pumpkin command to show better the text.

* Kill texts parity

Added translations to kill command, also added to show the player who is killed, and tell something to that user like vanilla. Also changed the color to white like vanilla.

* Added translate key of item

Added a function to item_registry which returns the appropriate TextComponent::translate for a item

* Give texts parity

Added translations to give command item, also added to show the player who receive the item, and tell something to that user like vanilla.

* CLIPPY MY LORD

* Reverted entity_type changes

I had not thought that I could use debug to get the name of the type, my mistake

* Added send_message to Player

Added the function send_message to allow sending DisgusedChatMessages directly to a specific player.

* Added msg command

Added msg (tell) command to match with the applied parity changes.

* Bossbar texts parity

Added translations and parity props for Bossbar command texts, without changing their behavior.
2025-01-28 00:08:07 +01:00
Alvsch
5f3f98060a Add bans and ip-bans (#436)
* added bans and ip-bans

* Added ban reason and expiring

* Added ban and ban-ip commands

* Added banlist command

* Added pardon and pardon-ip commands

* Simplified argument handling

* Fixed merge and started adding translations

* Finished translations for commands

* Merge + default reason

* fix: cargo fmt

* Fix client IP
2025-01-27 18:35:14 +01:00
Alexander Medvedev
2fdf0777f6 Add Summon Command
Also refactor some things:

- Remove cmd_ prefix from commands
- Remove arg_ prefix from arguments
2025-01-26 20:06:20 +01:00
Alexander Medvedev
31b04a6bae Add title command
- Fix TextComponentArgConsumer
- Rename with_child to then
- Rename ProtoCmdArgParser to ArgumentType
- Add title command, Mostly complete only "times" sub command is missing
2025-01-25 18:12:29 +01:00
vyPal
a0ae1ae515 add Plugin system (#339)
* Add pumpkin-api crate for API definitions

* Add proc-macro definitions for pumpkin-api

* Add pumpkin-api and pumpkin-api-macros to workspace

* Add basic PluginManager implementation plugin loading

* Update .gitignore to include specific plugin file types

* Add example plugin

* Cargo fmt

* Fix clippy issues

* Refactoring to prevent a circular import

* Add base impl for plugin hooks

* Move plugin manager to server

* Make metadata have static lifetime

* Add default implementations to events

* Add hooks to proc macro

* Update example

* Fix formatting

* Fix clippy warnings

* Load metadata from Cargo.toml

* Mark plugins as an implemented feature :D

* Implement new event handling

* Create a static global reference to the plugin manager

* Emit player join and leave events

* Update macro generation

* Update example

* Fix formatting

* Fix clippy issue

* Simplify event handling

* Add plugin command to list plugins

* Make handlers async

* Update macros

* Update example

* Fix formatting and clippy issues

* Better styling on plugins command

* Fix clippy issues

* Cargo fmt

* Disable doctest for lib target on pumpkin crate

* New API for plugins

* Update api macros

* Update plugin example

* A bit of clean up

* Some QoL (and performance) improvements

* Cargo fmt and clippy fixes

* refactoring, better event handling, new context functions

* Async on_load and on_unload

* Fix mutex lock never going out of scope

* Async plugin loading

* Add plugin management command

* Fix clippy issues

* Fix import issues

* Move TcpConnection out of client

* Move packet encoding out of client

* Allow plugins to register commands

* Fix fmt and clippy

* Implement plugin list in query

* Make arguments public so that plugins can use them

* Update proc_macros to handle runtime

* Make tree_builder public for use in plugins

* Make FindArg trait public for use in plugins

* Update example plugin

* Fix merge related issues

* Fix cargo fmt

* Post-merge fixes (also 69th commit, nice)

* New event system

* cargo fmt

* Impl block break event

* cargo fmt and clippy

* Reduced plugin size

* Reduce dependency count

* Old code cleanup

* cargo fmt

* Add event priority and blocking options to event registration and handling

* Refactor event handling to support blocking execution and improve event registration

* Fix post-merge errors

* Update example plugin

* increase mpsc channel capacity and handle write errors gracefully

* Use Arc<Player> instead of &Player

* add missing import

* Update example plugin with playing sounds

* Remove example plugin

* Create plugins dir if doesnt exist

* Remove unused vars

* Remove unnecessary clones

* Fix impl

* cargo fmt

* Make server pub in context
2025-01-24 17:26:09 +01:00
Alexander Medvedev
6c78567a83 add play sound command
Its simple and there are many arguments missing but its works
2025-01-23 23:40:20 +01:00
Commandcracker
1dcbea59a4 Add me Command (#288)
* Add me Command

* fixed everything and port to chat types

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2025-01-23 21:37:17 +01:00
Alexander Medvedev
996497259e fix rust 1.84 clippy warns 2025-01-09 19:51:06 +01:00
Alexander Medvedev
ee485056fb rename pumpkin-core to pumpkin-util
I see that there is an confusion between the pumpkin-core crate,  People often think that this is the most important one
2025-01-09 13:12:57 +01:00
smuu
4bfbff7c88 feat: add deop command and refactor op command (#440)
* fix: command permission handling

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

* fix: formatting

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

* feat: add deop command

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

* refactor: op command

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

* fix: fmt and clippy

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

* fix: merge conflict

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

* fix: cargo fmt

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

---------

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>
2025-01-01 22:49:04 +01:00
Alexander Medvedev
f772d971f6 Remove lifetime from TextComponent 2024-12-30 13:10:02 +01:00
smuu
2d136b1c24 fix: command permission message (#428)
* fix: command permission handling

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

* fix: formatting

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

---------

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>
2024-12-29 16:43:25 +01:00
Kyle Davis
6a5add8de5 Added native operator permission management (#348)
* Starting work on Operator permission system

This commit adds the ops.json configuration found in vanilla
servers, and updates the basic configuration to handle the default
permission level.

Server now uses ops file and defaults players to op level 0

The /op command has been added but needs players to rejoin for now.

* Clippy Fix + need to Rejoin after /op removed

I found the source of the DeadLock. Updated set permission function.

Fix cargo formatting issues and clippy issues.

* Remove temp warn message

* Move OperatorConfig to server

As Snowiii pointed out, OperatorConfig is runtime data.

Revert most changes in pumpkin-config.

op_permission_level must say in the basic configuration for
parity with Minecraft.

* cargo fmt + cargo clippy

* Sync permission change with client

* Fixs issues @Commandcracker found in review

- Move PermissionLvl to core and removed OpLevel
- Move ops.json to /data/ops.json
- Fix permissions issue with /op command
- Shorten /op command description

* refactor into `data` folder

* create data dir when needed

* add to readme

* fix: conflicts

---------

Co-authored-by: Alexander Medvedev <lilalexmed@proton.me>
2024-12-27 17:22:19 +01:00
urisinger
25f4834236 Remove unnecessary lifetimes in CommandDispatcher and Command (#419)
* make command dispatcher use owned strings and not take any lifetimes

* remove get_argument_consumer

* fix clippy

* fix elided lifetimes
2024-12-26 23:15:13 +01:00
kralverde
0e9b1af760 make command dispatcher writable (#405) 2024-12-25 14:43:26 +01:00
Snowiiii
7c90ef9f5a Remove Craft & Ender Chest commands
This was a temporary solution. Since b82a4e130b now is merged we can remove them
2024-12-07 16:25:07 +01:00
Snowiiii
5efa881090 Fix: Clippy 1.83 2024-11-28 21:52:55 +01:00
Kris
14b56bd955 Added World Time (#321)
* Added lighting

* Fixed clippy warnings

* Fixed import position

* Moved world ticks to world

* Fixed clippy

* Use format macro

* Fixed fmt

* Implemented add, query, set
2024-11-26 19:02:12 +01:00
Nico Göbel
c7e37f8cac Implemented the Bossbar (#306)
* Added first rough implementation of the bossbar

* Added basic structure for implementing the storing and command

* Added all commands. And started handling value and max

* fix errors

* Update player.rs

Fixed merging issue

* Finishing serialization

* Finalize command

* Fix clippy and fmt

* Format

* Fixed ultra stupid bug

* Fix clippy
2024-11-26 18:31:56 +01:00
Commandcracker
3a5fe5d424 Add basic fill command (#322)
* Add fill command
2024-11-20 22:41:43 +01:00
Commandcracker
2dbab76703 Add seed Command (#289)
* Add seed Command

* Get seed from level
2024-11-20 22:15:02 +01:00
Commandcracker
caff0df636 Add transfer command (#285)
* Add transfer command

* implement fmt::Display for CommandSender
2024-11-16 13:12:50 +01:00
user622628252416
29d203c8a9 Add /setblock command (#263)
* add /setblock command

* fix particles, block state id, block coordinate rounding, WoldPosition formatting

* fix block state/block mixup

---------

Co-authored-by: user622628252416 <nnew8715@gmail.com>
2024-11-14 20:23:10 +01:00
user622628252416
c2822f45f9 Add Command Suggestions and Tab Completion (#245)
* add prototype for /give command

* fix /give namespace

* fix accidentally replaced text

* replace block_registry with item_registry

* sync added items with client

* add command and command suggestion packets

* Add List command  (#238)

* List command

* Stop message on /stop

* add coverter for (mostly) correctly obtaining CCommands packet payload from CommandDispatcher

* fix proof of concept suggestions replacing entire command

* add client side command argument suggestions

* fix arg_position_2d and arg_position_3d not setting pos to block center when coordinate is an integer

* add optional server side command suggestions

* disable serverside suggestions for entity args

* remove pumpkin test client_side_arg_parsers

* use unsigned bytes for flags

* add missing command arg parsers

* fix entities parser flags

* add player permission level

* fix merge conflicts

---------

Co-authored-by: user622628252416 <nnew8715@gmail.com>
Co-authored-by: Victor <47831936+solvictor@users.noreply.github.com>
2024-11-12 20:49:31 +01:00
Edvin Bryntesson
98e8bba936 Inventory cleanup (#256)
* add pumpkin error handling for commands

* cleanup clear command

* fix so that all Container implementations follow the same order as the trait

* cleanup give command

* remove unnecessary function

* remove unnecessary function

* fix give command

* fix clear command

* fixup item placement logic

* cleanup clear command a little
2024-11-12 19:24:52 +01:00
Edvin Bryntesson
8cde02e625 Add Shaped and Unshaped crafting support, as well as deserializing the entire recipe format (#165)
* add cleaner registry parsing

* start adding recipes

* add tags, and some crafting things

* Fix echest command

* add partly working crafting interface

* add generated assets

* fix container commands and clippy lints

* fix issues with resolving recursive item tags for crafting

* add flatten3x3 function

* add shapeless crafting

* add tests to and fix recipe flattening function

* refactor recipe system a bit

* add rayon to speed up initial loading of recipes

* almost working after rebase

* add deserialization for new crafting type "transmute"

* make crafting work again

* make shapeless recipes not require all permutations

* fixed visual bug with when taking out ingredients for crafting

* add support for new tags system
2024-11-12 12:57:14 +01:00
Victor
80bfee705c Clear command and details (#250)
* Clear command

* Version alias
2024-11-11 22:42:02 +01:00
user622628252416
16dabf1826 Add /give Command (#234)
* add prototype for /give command

* fix /give namespace

* fix accidentally replaced text

* remove dbg! statements

* replace block_registry with item_registry

* sync added items with client

* warn!(..) => log::warn!(..)

---------

Co-authored-by: user622628252416 <nnew8715@gmail.com>
2024-11-07 20:34:56 +01:00
Victor
41e71a857d Add List command (#238)
* List command

* Stop message on /stop
2024-11-07 16:32:27 +01:00
user622628252416
87aa5ec493 Commands: Fix Bug, Refactor Arguments, Add /tp (#227)
* fix command dispatch, add/refactor arguments & add tp command

* implement teleport facing location/facing entity

* implement teleport facing location/facing entity

* implement arg_player/arg_entity and refactor commands accordingly

* implement ~ coordinate notation

* refactor arg_position_3d

* major command refactor

* add documentation

* add default names to more argument types

* add argument names to arg_bounded_nums

* change command argument api

---------

Co-authored-by: user622628252416 <nnew8715@gmail.com>
2024-11-03 23:15:49 +01:00
Snowiiii
9f70b95b9b Split commands into their own Folder
Now its much nicer separate from the command base
2024-10-29 22:47:52 +01:00