Skip to content

Commit

Permalink
Merge pull request #74 from FTBTeam/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
desht authored Dec 18, 2024
2 parents 5be183a + 386cd77 commit d7d6ff8
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 20 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Java CI - Build Release

on:
release:
types: [ published ]
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
- 'v[0-9]+\.[0-9]+\.[0-9]+-[a-z]+'
- 'v[0-9]+\.[0-9]+\.[0-9]+-[a-z]+\.[0-9]+'

jobs:
build:
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ 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).

## [2101.1.1]

### Added
* Added fr_fr translation (thanks @Nogapra)
* Added tr_tr translation (thanks @RuyaSavascisi)

### Fixed
* Fixed command cooldowns not being sufficiently dynamically calculated
* E.g. if a player runs a teleport command, and then adds a FTB Ranks node to reduce their cooldown
* Cooldowns are now recalculated on each command attempt rather than precalculated on a successful run
* Fixed the `/rtp` command sometimes sending players to bad destinations
* Was particularly an issue in the Nether (and likely other roofed dimensions)

## [2101.1.0]

### Changed
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
}

apply from: 'https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/changelog.gradle'

architectury {
minecraft = rootProject.minecraft_version
}
Expand Down Expand Up @@ -104,7 +106,7 @@ allprojects {

publishMods {
dryRun = providers.environmentVariable("CURSEFORGE_KEY").getOrNull() == null
changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided")
changelog = createChangelog(project)
version = mod_version

// TODO: Migrate to something else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,13 @@ private static TeleportPos findBlockPos(ServerLevel world, ServerPlayer player)
BlockState bs = world.getBlockState(newPos);
if (bs.blocksMotion() && !bs.is(IGNORE_RTP_BLOCKS) && world.isEmptyBlock(newPos.above(1))
&& world.isEmptyBlock(newPos.above(2)) && world.isEmptyBlock(newPos.above(3))) {
goodPos = newPos;
goodPos = newPos.immutable();
break;
}
}
}
if (goodPos != null) {
player.displayClientMessage(Component.literal(String.format("Found good location after %d " + (attempt == 1 ? "attempt" : "attempts") + " @ [x %d, z %d]", attempt, goodPos.getX(), goodPos.getZ())), false);
player.displayClientMessage(Component.literal(String.format("Found good location after %d " + (attempt == 1 ? "attempt" : "attempts") + " @ [x %d, y %d, z %d]", attempt, goodPos.getX(), goodPos.getY(), goodPos.getZ())), false);
return new TeleportPos(world.dimension(), goodPos.above());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public int tpa(ServerPlayer player, ServerPlayer target, boolean here) {
}

TeleportPos.TeleportResult result = here ?
dataTarget.tpaTeleporter.checkCooldown() :
dataSource.tpaTeleporter.checkCooldown();
dataTarget.tpaTeleporter.checkCooldown(target) :
dataSource.tpaTeleporter.checkCooldown(player);

if (!result.isSuccess()) {
return result.runCommand(player);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package dev.ftb.mods.ftbessentials.util;

import dev.architectury.hooks.level.entity.PlayerHooks;
import dev.architectury.networking.NetworkManager;
import dev.ftb.mods.ftbessentials.FTBEssentials;
import dev.ftb.mods.ftbessentials.config.FTBEConfig;
import dev.ftb.mods.ftbessentials.net.UpdateTabNameMessage;
import dev.ftb.mods.ftblibrary.config.NameMap;
import dev.ftb.mods.ftblibrary.snbt.SNBT;
import dev.ftb.mods.ftblibrary.snbt.SNBTCompoundTag;
import dev.ftb.mods.ftblibrary.util.NetworkHelper;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -300,11 +300,11 @@ public void saveIfChanged() {
}

public void sendTabName(MinecraftServer server) {
NetworkManager.sendToPlayers(server.getPlayerList().getPlayers(), new UpdateTabNameMessage(uuid, name, nick, recording, false));
NetworkHelper.sendToAll(server, new UpdateTabNameMessage(uuid, name, nick, recording, false));
}

public void sendTabName(ServerPlayer to) {
NetworkManager.sendToPlayer(to, new UpdateTabNameMessage(uuid, name, nick, recording, false));
NetworkHelper.sendTo(to, new UpdateTabNameMessage(uuid, name, nick, recording, false));
}

public long getLastKitUseTime(String kitName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class WarmupCooldownTeleporter {
private final ToIntFunction<ServerPlayer> warmupConfig;
private final boolean popHistoryOnTeleport;

private long cooldown;
private long lastRun; // time of the last run of the command (which wasn't on cooldown)

private static final Map<UUID, Warmup> WARMUPS = new HashMap<>();
private static final Map<UUID, Warmup> pendingAdditions = new HashMap<>();
Expand All @@ -35,14 +35,15 @@ public WarmupCooldownTeleporter(FTBEPlayerData playerData, ToIntFunction<ServerP
this.cooldownConfig = cooldownConfig;
this.warmupConfig = warmupConfig;
this.popHistoryOnTeleport = popHistoryOnTeleport;
this.cooldown = 0L;
this.lastRun = 0L;
}

public TeleportResult checkCooldown() {
public TeleportResult checkCooldown(ServerPlayer player) {
long now = System.currentTimeMillis();
long nextRun = lastRun + Math.max(0L, cooldownConfig.applyAsInt(player) * 1000L);

if (now < cooldown) {
return (TeleportPos.CooldownTeleportResult) () -> cooldown - now;
if (now < nextRun) {
return (TeleportPos.CooldownTeleportResult) () -> nextRun - now;
}

return TeleportResult.SUCCESS;
Expand All @@ -54,7 +55,7 @@ public TeleportResult teleport(ServerPlayer player, Function<ServerPlayer, Telep
return TeleportResult.failed(result.object());
}

TeleportResult cooldownResult = checkCooldown();
TeleportResult cooldownResult = checkCooldown(player);
if (!cooldownResult.isSuccess()) {
return cooldownResult;
}
Expand All @@ -72,7 +73,7 @@ public TeleportResult teleport(ServerPlayer player, Function<ServerPlayer, Telep
}

private TeleportResult teleportNow(ServerPlayer player, Function<ServerPlayer, TeleportPos> positionGetter) {
cooldown = System.currentTimeMillis() + Math.max(0L, cooldownConfig.applyAsInt(player) * 1000L);
lastRun = System.currentTimeMillis();

TeleportPos teleportPos = positionGetter.apply(player);
TeleportPos currentPos = new TeleportPos(player);
Expand Down
10 changes: 10 additions & 0 deletions common/src/main/resources/assets/ftbessentials/lang/fr_fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"sidebar_button.ftbessentials.trash_can": "Poubelle",
"ftbessentials.chat.status.start_record": "est en cours d’enregistrement !",
"ftbessentials.chat.status.stop_record": "n’enregistre plus !",
"ftbessentials.chat.status.start_stream": "est maintenant en streaming !",
"ftbessentials.chat.status.stop_stream": "n’est plus en streaming !",
"ftbessentials.messages.kick_self": "Vous vous êtes kick du serveur vous même !",
"ftbessentials.feedback.limit_radius": "Limitation du rayon à %s",
"ftbessentials.feedback.players_within": "%s joueur(s) dans %sm"
}
10 changes: 10 additions & 0 deletions common/src/main/resources/assets/ftbessentials/lang/tr_tr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"sidebar_button.ftbessentials.trash_can": "Çöp Kovası",
"ftbessentials.chat.status.start_record": "şimdi kayıt yapıyor!",
"ftbessentials.chat.status.stop_record": "artık kayıt yapmıyor!",
"ftbessentials.chat.status.start_stream": "şimdi yayın yapıyor!",
"ftbessentials.chat.status.stop_stream": "artık yayın yapmıyor!",
"ftbessentials.messages.kick_self": "Kendini attın!",
"ftbessentials.feedback.limit_radius": "Yarıçap %s ile sınırlandırılıyor",
"ftbessentials.feedback.players_within": "%s oyuncu(lar) %sm içinde"
}
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ archives_base_name=ftb-essentials
maven_group=dev.ftb.mods

minecraft_version=1.21.1
mod_version=2101.1.0
mod_version=2101.1.1
mod_author=FTB Team

# Deps
#forge_version=50.0.9
neoforge_version=21.1.9
neoforge_version=21.1.72
neoforge_version_range=[21.1.0,)
neoforge_loader_version=4

Expand All @@ -24,7 +24,7 @@ fabric_api_version_range=>=0.100.1+1.21

architectury_api_version=13.0.6

ftb_library_version=2101.1.0
ftb_library_version=2101.1.4
ftb_ranks_version=2100.1.0

# common curseforge project for forge and fabric
Expand Down

0 comments on commit d7d6ff8

Please sign in to comment.