Skip to content

Commit 34a1493

Browse files
authored
Merge pull request #318 from FTBTeam/dev
Dev
2 parents 591811c + d7cf41b commit 34a1493

17 files changed

+930
-391
lines changed

Diff for: CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2101.1.1]
8+
9+
### Added
10+
* Added `/ftbchunks admin open_claim_gui_as` command
11+
* Allows server admins to open the chunk claim gui as any player
12+
* Offline players are also supported, but names of offline players aren't suggested in command tab-completion
13+
* Added team property defaults in server config (see "Team Property Defaults" section)
14+
* Properties for newly-created teams are now taken from these defaults
15+
16+
### Changed
17+
* Reworked the chunk claim GUI for a more polished visual appearance
18+
* Added an "Unclaim All" button (trash can button, top-left) to reset all claims
19+
720
## [2101.1.0]
821

922
### Changed

Diff for: common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksCommands.java

+13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.ftb.mods.ftbchunks;
22

3+
import com.mojang.brigadier.Command;
34
import com.mojang.brigadier.CommandDispatcher;
45
import com.mojang.brigadier.arguments.BoolArgumentType;
56
import com.mojang.brigadier.arguments.IntegerArgumentType;
@@ -18,6 +19,7 @@
1819
import dev.ftb.mods.ftbchunks.data.ClaimedChunkManagerImpl;
1920
import dev.ftb.mods.ftbchunks.net.AddWaypointPacket;
2021
import dev.ftb.mods.ftbchunks.net.LoadedChunkViewPacket;
22+
import dev.ftb.mods.ftbchunks.net.OpenClaimGUIPacket;
2123
import dev.ftb.mods.ftbchunks.net.RequestBlockColorPacket;
2224
import dev.ftb.mods.ftbchunks.net.SendGeneralDataPacket;
2325
import dev.ftb.mods.ftblibrary.math.ChunkDimPos;
@@ -179,6 +181,11 @@ public static void registerCommands(CommandDispatcher<CommandSourceStack> dispat
179181
.executes(context -> viewLoadedChunks(context.getSource(), DimensionArgument.getDimension(context, "dimension")))
180182
)
181183
)
184+
.then(Commands.literal("open_claim_gui_as")
185+
.then(Commands.argument("team", TeamArgument.create())
186+
.executes(FTBChunksCommands::openClaimGuiAs)
187+
)
188+
)
182189
)
183190
.then(Commands.literal("block_color")
184191
// .requires(source -> source.getServer().isSingleplayer())
@@ -239,6 +246,12 @@ private static int bypassProtection(CommandSourceStack source) throws CommandSyn
239246
return 1;
240247
}
241248

249+
private static int openClaimGuiAs(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
250+
Team team = TeamArgument.get(context, "team");
251+
NetworkManager.sendToPlayer(context.getSource().getPlayerOrException(), new OpenClaimGUIPacket(team.getTeamId()));
252+
return Command.SINGLE_SUCCESS;
253+
}
254+
242255
private interface ChunkCallback {
243256
void accept(ChunkTeamDataImpl data, ChunkDimPos pos) throws CommandSyntaxException;
244257
}

Diff for: common/src/main/java/dev/ftb/mods/ftbchunks/FTBChunksWorldConfig.java

+83-25
Large diffs are not rendered by default.

Diff for: common/src/main/java/dev/ftb/mods/ftbchunks/api/ChunkTeamData.java

+45-3
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,36 @@ public interface ChunkTeamData {
6969
* @param source the command source (player or console) unclaiming the chunk
7070
* @param pos the combined dimension and chunk pos
7171
* @param checkOnly true if just simulating the unclaim
72+
* @param adminOverride if true, admins can unclaim regardless chunk ownership
7273
*
7374
* @return the result of the attempt
7475
*/
75-
ClaimResult unclaim(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly);
76+
ClaimResult unclaim(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly, boolean adminOverride);
77+
78+
/**
79+
* Try to release any claim on the given chunk for this team.
80+
*
81+
* @param source the command source (player or console) unclaiming the chunk
82+
* @param pos the combined dimension and chunk pos
83+
* @param checkOnly true if just simulating the unclaim
84+
*
85+
* @return the result of the attempt
86+
*/
87+
default ClaimResult unclaim(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly) {
88+
return unclaim(source, pos, checkOnly, true);
89+
}
90+
91+
/**
92+
* Try to force-load the given chunk for this team.
93+
*
94+
* @param source the command source (player or console) force-loading the chunk
95+
* @param pos the combined dimension and chunk pos
96+
* @param checkOnly true if just simulating the force-load
97+
* @param adminOverride if true, admins can force-load regardless chunk ownership
98+
*
99+
* @return the result of the attempt
100+
*/
101+
ClaimResult forceLoad(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly, boolean adminOverride);
76102

77103
/**
78104
* Try to force-load the given chunk for this team.
@@ -83,7 +109,21 @@ public interface ChunkTeamData {
83109
*
84110
* @return the result of the attempt
85111
*/
86-
ClaimResult forceLoad(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly);
112+
default ClaimResult forceLoad(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly) {
113+
return forceLoad(source, pos, checkOnly, true);
114+
}
115+
116+
/**
117+
* Try to cancel any force-load this team has for the given chunk.
118+
*
119+
* @param source the command source (player or console) un-force-loading the chunk
120+
* @param pos the combined dimension and chunk pos
121+
* @param checkOnly true if just simulating the un-force-load
122+
* @param adminOverride if true, admins can un-force regardless chunk ownership
123+
*
124+
* @return the un-force-load result
125+
*/
126+
ClaimResult unForceLoad(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly, boolean adminOverride);
87127

88128
/**
89129
* Try to cancel any force-load this team has for the given chunk.
@@ -94,7 +134,9 @@ public interface ChunkTeamData {
94134
*
95135
* @return the un-force-load result
96136
*/
97-
ClaimResult unForceLoad(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly);
137+
default ClaimResult unForceLoad(CommandSourceStack source, ChunkDimPos pos, boolean checkOnly) {
138+
return unForceLoad(source, pos, checkOnly, true);
139+
}
98140

99141
/**
100142
* Convenience method to check if the given player ID is a member of this team
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.ftb.mods.ftbchunks.api;
22

3+
import dev.ftb.mods.ftbchunks.FTBChunksWorldConfig;
34
import dev.ftb.mods.ftbteams.api.property.BooleanProperty;
45
import dev.ftb.mods.ftbteams.api.property.PrivacyMode;
56
import dev.ftb.mods.ftbteams.api.property.PrivacyProperty;
@@ -12,34 +13,34 @@
1213
*/
1314
public class FTBChunksProperties {
1415
public static final BooleanProperty ALLOW_ALL_FAKE_PLAYERS
15-
= new BooleanProperty(FTBChunksAPI.rl("allow_fake_players"), false);
16+
= new BooleanProperty(FTBChunksAPI.rl("allow_fake_players"), FTBChunksWorldConfig.DEF_ALLOW_FAKE_PLAYERS::get);
1617
public static final StringListProperty ALLOW_NAMED_FAKE_PLAYERS
17-
= new StringListProperty(FTBChunksAPI.rl("allow_named_fake_players"), new ArrayList<>());
18+
= new StringListProperty(FTBChunksAPI.rl("allow_named_fake_players"), () -> new ArrayList<>(FTBChunksWorldConfig.DEF_ALLOW_NAMED_FAKE_PLAYERS.get()));
1819
public static final BooleanProperty ALLOW_FAKE_PLAYERS_BY_ID
19-
= new BooleanProperty(FTBChunksAPI.rl("allow_fake_players_by_id"), true);
20+
= new BooleanProperty(FTBChunksAPI.rl("allow_fake_players_by_id"), FTBChunksWorldConfig.DEF_ALLOW_FAKE_PLAYER_IDS::get);
2021
public static final PrivacyProperty ENTITY_INTERACT_MODE
21-
= new PrivacyProperty(FTBChunksAPI.rl("entity_interact_mode"), PrivacyMode.ALLIES);
22+
= new PrivacyProperty(FTBChunksAPI.rl("entity_interact_mode"), FTBChunksWorldConfig.DEF_ENTITY_INTERACT::get);
2223
public static final PrivacyProperty NONLIVING_ENTITY_ATTACK_MODE
23-
= new PrivacyProperty(FTBChunksAPI.rl("nonliving_entity_attack_mode"), PrivacyMode.ALLIES);
24+
= new PrivacyProperty(FTBChunksAPI.rl("nonliving_entity_attack_mode"), FTBChunksWorldConfig.DEF_NONLIVING_ENTITY_ATTACK::get);
2425
public static final BooleanProperty ALLOW_EXPLOSIONS
25-
= new BooleanProperty(FTBChunksAPI.rl("allow_explosions"), false);
26+
= new BooleanProperty(FTBChunksAPI.rl("allow_explosions"), FTBChunksWorldConfig.DEF_ALLOW_EXPLOSIONS::get);
2627
public static final BooleanProperty ALLOW_MOB_GRIEFING
27-
= new BooleanProperty(FTBChunksAPI.rl("allow_mob_griefing"), false);
28+
= new BooleanProperty(FTBChunksAPI.rl("allow_mob_griefing"), FTBChunksWorldConfig.DEF_MOB_GRIEFING::get);
2829
public static final PrivacyProperty CLAIM_VISIBILITY
29-
= new PrivacyProperty(FTBChunksAPI.rl("claim_visibility"), PrivacyMode.PUBLIC);
30+
= new PrivacyProperty(FTBChunksAPI.rl("claim_visibility"), FTBChunksWorldConfig.DEF_CLAIM_VISIBILITY::get);
3031
public static final PrivacyProperty LOCATION_MODE
31-
= new PrivacyProperty(FTBChunksAPI.rl("location_mode"), PrivacyMode.ALLIES);
32+
= new PrivacyProperty(FTBChunksAPI.rl("location_mode"), FTBChunksWorldConfig.DEF_PLAYER_VISIBILITY::get);
3233
public static final BooleanProperty ALLOW_PVP
33-
= new BooleanProperty(FTBChunksAPI.rl("allow_pvp"), true);
34+
= new BooleanProperty(FTBChunksAPI.rl("allow_pvp"), FTBChunksWorldConfig.DEF_PVP::get);
3435

3536
// FTB Chunks on Forge adds two separate block edit & interact properties
3637
public static final PrivacyProperty BLOCK_EDIT_MODE
37-
= new PrivacyProperty(FTBChunksAPI.rl("block_edit_mode"), PrivacyMode.ALLIES);
38+
= new PrivacyProperty(FTBChunksAPI.rl("block_edit_mode"), FTBChunksWorldConfig.DEF_BLOCK_EDIT::get);
3839
public static final PrivacyProperty BLOCK_INTERACT_MODE
39-
= new PrivacyProperty(FTBChunksAPI.rl("block_interact_mode"), PrivacyMode.ALLIES);
40+
= new PrivacyProperty(FTBChunksAPI.rl("block_interact_mode"), FTBChunksWorldConfig.DEF_BLOCK_INTERACT::get);
4041

4142
// FTB Chunks on Fabric adds a combined block edit & interact property
4243
public static final PrivacyProperty BLOCK_EDIT_AND_INTERACT_MODE
43-
= new PrivacyProperty(FTBChunksAPI.rl("block_edit_and_interact_mode"), PrivacyMode.ALLIES);
44+
= new PrivacyProperty(FTBChunksAPI.rl("block_edit_and_interact_mode"), FTBChunksWorldConfig.DEF_BLOCK_EDIT_INTERACT::get);
4445

4546
}

Diff for: common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,11 @@ public EventResult keyPressed(Minecraft client, int keyCode, int scanCode, int a
366366
FTBChunksClientConfig.saveConfig();
367367
return EventResult.interruptTrue();
368368
} else if (doesKeybindMatch(openClaimManagerKey, keyCode, scanCode, modifiers)) {
369-
ChunkScreen.openChunkScreen();
369+
try {
370+
ChunkScreen.openChunkScreen();
371+
}catch (Exception e){
372+
e.printStackTrace();
373+
}
370374
return EventResult.interruptTrue();
371375
} else if (doesKeybindMatch(zoomInKey, keyCode, scanCode, modifiers)) {
372376
return changeZoom(true);
@@ -1167,6 +1171,10 @@ public List<Component> getChunkSummary() {
11671171
return list;
11681172
}
11691173

1174+
public GeneralChunkData getGeneralChunkData() {
1175+
return generalChunkData;
1176+
}
1177+
11701178
public int getMinimapTextureId() {
11711179
return minimapTextureId;
11721180
}

0 commit comments

Comments
 (0)