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

Add Config to allow servers to re-enable support for client-side 'hacks' like Staff Of Traveling Keybind mod. #142

Merged
merged 4 commits into from
Dec 20, 2023
Merged
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
8 changes: 8 additions & 0 deletions src/main/java/crazypants/enderio/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public String lc() {
public static String[] travelStaffBlinkBlackList = new String[] { "minecraft:bedrock", "Thaumcraft:blockWarded" };
public static float travelAnchorZoomScale = 0.2f;
public static boolean travelStaffSearchOptimize = true;
public static boolean validateTravelEventServerside = true;

/** The max distance for travelling to a Travel Anchor. */
public static int teleportStaffMaxDistance = 2048;
Expand Down Expand Up @@ -1214,6 +1215,13 @@ public static void processConfig(Configuration config) {
+ "This config is experimental, so if you encounter any strange behavior, please report to GTNH developer.")
.getBoolean(travelStaffSearchOptimize);

validateTravelEventServerside = config.get(
sectionStaff.name,
"validateTravelEventServerside",
validateTravelEventServerside,
"If set to true: Server will validate if player actually can teleport. False will allow hacking, but also allows Staff of Traveling Keybind mod to work.")
.getBoolean(validateTravelEventServerside);

teleportStaffMaxDistance = config
.get(
sectionStaff.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ private TravelController() {
*/
public String validatePacketTravelEvent(EntityPlayerMP toTp, int x, int y, int z, int powerUse,
boolean conserveMotion, TravelSource source) {

// If config indicates to allow for 'hacking' the travel packet, then don't do any validation.
if (!Config.validateTravelEventServerside) return null;

BlockCoord target = new BlockCoord(x, y, z);
double dist = getDistanceSquared(toTp, target);
// allow 15% overshoot to account for rounding
Expand Down