diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index 3980e855b6..783eb227df 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -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; @@ -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, diff --git a/src/main/java/crazypants/enderio/teleport/TravelController.java b/src/main/java/crazypants/enderio/teleport/TravelController.java index c4774ea85b..b2426e45b8 100644 --- a/src/main/java/crazypants/enderio/teleport/TravelController.java +++ b/src/main/java/crazypants/enderio/teleport/TravelController.java @@ -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