Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #51

Merged
merged 16 commits into from
Sep 29, 2023
Merged

Dev #51

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [2001.2.0]

### Added
* Added Kits! Kits are configurable collections of items which can be given to players with a single command
* See https://github.com/FTBTeam/FTB-Essentials/wiki/kits.md for a quick overview of how to manage kits
* Added `/tp_offline` command, allowing admins to change the position of offline players
* Dimension can also be changed using the standard vanilla `/execute in <dimension> run tp_offline ...` syntax
* Added several commands to open some vanilla work site blocks without needing the block:
* `/crafting` opens a Crafting Table GUI
* `/stonecutter` opens a Stonecutter GUI
* `/smithing` opens a Smithing Table GUI
* `/anvil` opens an Anvil GUI
* Added a `/jump` command to instantly teleport to the top of the focused block (or block column)
* E.g. targeting the side of a wall will place you on top of the wall after a `/jump`
* Added a `/speed` command to check or adjust a player's walking speed boost
* `/speed <boost_pct> [<player>]` can be used to give a player a speed boost modifier, expressed as a percentage
* e.g. `/speed 50` makes you walk 50% faster
* Valid ranges are -100 (completely stopped) -> 2000 (stupidly fast)
* Added a `/near` command to list nearby players and their distance from you (or a target player)
* Added a `/feed` command to restore a player's food level (and full saturation)
* Added a `/extinguish` command to extinguish a player who's currently on fire
* Fire a cancellable Architectury event when player is about to teleport due to any Essentials command
* Can be caught and cancelled by other mods if they want to prevent teleportation under specific circumstances
* Event is `TeleportEvent.TELEPORT`

### Fixed
* Fixed server crash related to auto-unmuting players who have gone offline
* Fixed pitch and yaw being swapped when teleporting to saved positions (homes, warps)

## [2001.1.2]

### Added
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false
}

architectury {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import dev.ftb.mods.ftbessentials.command.FTBEssentialsCommands;
import dev.ftb.mods.ftbessentials.command.TPACommands;
import dev.ftb.mods.ftbessentials.config.FTBEConfig;
import dev.ftb.mods.ftbessentials.kit.KitManager;
import dev.ftb.mods.ftbessentials.util.FTBEPlayerData;
import dev.ftb.mods.ftbessentials.util.FTBEWorldData;
import dev.ftb.mods.ftbessentials.util.TeleportPos;
Expand Down Expand Up @@ -92,25 +93,24 @@ private static void registerCommands(CommandDispatcher<CommandSourceStack> dispa

private static void levelSave(ServerLevel serverLevel) {
if (FTBEWorldData.instance != null) {
FTBEWorldData.instance.saveNow();

if (Platform.isFabric()) {
// on Forge, data is saved by the PlayerEvent.SaveToFile event handler
FTBEPlayerData.saveAll();
}
FTBEWorldData.instance.saveIfChanged();
FTBEPlayerData.saveAll();
}
}

private static void playerLoggedIn(ServerPlayer serverPlayer) {
FTBEPlayerData.getOrCreate(serverPlayer).ifPresent(data -> {
if (Platform.isFabric()) {
// on Forge, data is loaded by the PlayerEvent.LoadFromFile event handler
data.load();
}
data.load();
data.setLastSeenPos(new TeleportPos(serverPlayer));
data.markDirty();

FTBEPlayerData.sendPlayerTabs(serverPlayer);

KitManager.getInstance().allKits().forEach(kit -> {
if (kit.isAutoGrant()) {
kit.giveToPlayer(serverPlayer, data, false);
}
});
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.ftb.mods.ftbessentials.util;
package dev.ftb.mods.ftbessentials.api.event;

import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package dev.ftb.mods.ftbessentials.api.event;

import dev.architectury.event.CompoundEventResult;
import dev.architectury.event.Event;
import dev.architectury.event.EventFactory;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;

public class TeleportEvent {
public static Event<Teleport> TELEPORT = EventFactory.createCompoundEventResult();

public interface Teleport {
CompoundEventResult<Component> teleport(ServerPlayer player);
}
}
Loading