Git Product home page Git Product logo

custom-lan's Introduction

Custom LAN

Screenshot of Custom LAN A Fabric mod that allows you to:

  • Customize more of your integrated server (Online Mode, PvP, Max Players, MOTD)
  • Use ampersands (&) for formatting codes instead of section signs (§) and variables (e.g. ${username}, ${world}) in the MOTD
  • Change the settings mid-game (including the port) and stop the server without quitting the world
  • Save the settings globally or per-world (they are loaded automatically with per-world settings taking priority over the global ones, which take priority over the system defaults)
  • Change who can use cheats individually using the /op and /deop commands and cheat in singleplayer without opening to LAN (replaces the Allow Cheats button)
  • Manage bans with /ban, /ban-ip, /banlist, /pardon and /pardon-ip, and whitelist players with /whitelist (use /whitelist on/off to enable/disable)
  • Expose your server outside of your LAN without port forwarding using tunnels (currently only ngrok is supported)

It also allows you to start the LAN world by pressing Enter, doesn't force the gamemode (e.g. anyone who left in Creative mode will still be in Creative when they join even if the world is set to Survival), and extends the /publish command, which can now change settings mid-game as well (use a port of -1 to randomize it):

/publish [<port>] [<onlineMode>] [<pvpEnabled>] [<maxPlayers>] [<defaultGameMode>] [<tunnel>] [<motd>]
/publish [perworld|global|system] [<port>] [<onlineMode>] [<pvpEnabled>] [<maxPlayers>] [<defaultGameMode>] [<tunnel>] [<motd>]
/publish stop

It requires Fabric Loader and Cloth Config API, but Fabric API is not required.

It has been backported to all Minecraft versions supported by Fabric (except the snapshots)! I'm not planning on porting it to Forge myself for now, but you're more than welcome to send me a pull request.

Explanation of MOTD formatting codes and variables

In the MOTD, ampersands (&) are replaced with section signs (§) to allow you to enter formatting codes (e.g. &9Hello, &a&lworld! makes Hello, blue and world! green and bold). You can use two ampersands in a row (&&) to get an actual ampersand (&).

The following variables will be expanded using Apache Commons Text's StringSubstitutor:

  • ${username} – the host's username (e.g. “DimiDimit”)
  • ${world} – the world's name (e.g. “New World”)

Explanation of saved settings

The settings can be saved per-world or globally. When the Open to LAN screen is opened, the settings are loaded automatically in that order, and they can also be loaded manually using the Load buttons.

Using the /publish command without specifying which saved settings to use (perworld, global or system) uses the same order if the world hasn't been opened to LAN, or the current values instead of any saved settings if it has. Specifying the saved settings uses those particular settings or the system defaults if they haven't been saved, without checking any others, even if the world has been opened to LAN (e.g. if perworld is specified and no per-world settings are saved, the system defaults will be used even if there are saved global settings). The settings specified as arguments will override the saved settings or current values (e.g. /publish perworld 12345 false will use the per-world settings, except that the port will be 12345 and online mode will be disabled).

The global settings are stored in .minecraft/config/customlan.toml, while the per-world ones are stored in data/customlan.dat in the respective world's directory.

Explanation of /op and /deop

/op and /deop work like in dedicated servers. You can also use them on yourself, the host. Doing this will add/remove the “Cheats” label on the world (as if you've NBT edited the allowCommands field), and you can use these commands without opening to LAN as well, replacing the Vanilla method of opening to LAN, cheating, quitting the world and entering it again.

Operators are persisted per-world in an ops.json file inside that world's directory. To allow operators to assign and remove other operators, as well as ban and whitelist players, change their level in the ops.json file to 3 or higher (the default is 2, while level 4 allows them to use /publish). You, as the host, can always assign and remove operators, even if you're not an operator yourself.

Explanation of bans and whitelists

These commands also work like in dedicated servers, though you cannot ban or whitelist the host. Enabling the whitelist does not kick all non-whitelisted players (i.e. enforce-whitelist is always false).

The files used are also per-world and the same as on dedicated servers—banned-players.json, banned-ips.json, whitelist.json—though whether the whitelist is enabled is stored in data/customlan.dat.

custom-lan's People

Contributors

calvineries avatar cape-city avatar dimidimit avatar felix14-v2 avatar luadewi avatar mpustovoi avatar polypoyo avatar xfedex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

custom-lan's Issues

compatibility with Ngrok LAN

So, this mod reaaaaally helps out when used with ESSENTIAL, and simple voice chat, because everytime you open LAN, the port always changes, but with custom LAN, voicechat keeps the same port so there is no need for tweaking the config files everytime

but I prefer using Ngrok LAN because for some reason is less laggy and buggy than essential, the only downside being the forever changing port, but Custom LAN is not compatible with Ngrok LAN (crashes when opening the OPEN TO LAN menu), and is the most convinient way to use simple voice chat, so finding a way to pair Ngrok with custom lan would be really cool

maybe it doesnt work because of how ports work n stuff but idunno about that stuff, wouldnt hurt to try tho, if it worked with essential, why wouldnt it work with Ngrok

Feature: Auto open to LAN

If possible in a future release could you add an option to auto-load per world settings and open the world to LAN automatically when the world is started.

UPNP functionality?

It would be awesome cause there are no 1.17.1 mods with such option for casual non-techy guys

Custom LAN crashes in 1.19.

When attempting to load any singleplayer worlds, The safe mode button automatically gets shown but when you try to create new worlds instead; the client will just crash.

Working together

Hi,

I accidentally found your repo. Looks like we are working on a very similar concept.

https://github.com/rikka0w0/LanServerProperties

What do you think about working together at some point? My implementation supports both Forge and Fabric. It uses Mojang mapping. I have created a thin abstraction layer to isolate the difference of the mod loaders and underlying APIs. Most code only needs to be written once.

Regards,

Minecraft Options button faded out on servers

I'm playing on 1.16 with the Mod Menu mod, which adds an extra button to the pause menu. It seems this it messes with the button order and this mod disables the wrong one, because when I'm playing on a server with it I can't access either my options nor the LAN menu.

Add Support for Minecraft 1.21

Hello,

I have a Minecraft World which is currently on Minecraft version 1.21. I want to install this Mod on my world, but unfortunately, the Mod isn‘t currently available for Minecraft 1.21 so I wanted to ask you: Can you please port this Mod to 1.21? This may be very nice!

Greetings,
Atten007 :)

Where and how to throw authtoken ngrok

I changed the config file and added a token between "" but it didn't change anything. Then I restarted minecraft and tried to use tunnels again and minecraft just crashed (it looks like something that might help https://mclo.gs/QjMgKUt ) I have no idea what else can be done to make the mod see authtoken

Thank you for your help

"Edit LAN" gets replaced with the player reporting button

Whenever the no-chat-reporting mod is installed or not iirc, opening the "Edit LAN" button will cause it to re-direct to the player reporting page instead since 1.19.1,

Originally this issue went to #100 but decided to re-direct it here to see if it possible to have the two buttons resolved since other dev explained that it isn't their issue.

Error when saving the world

So, after updating to [1.20-1.20.1] Custom LAN 2.3.0 after quitting the world, it always takes about 2 minutes to save it. Moreover, it doesn't depend on whether I did something in this world by loading chunks maybe or I immediately left it.
I looked at latest.log after leaving my main and test world. Every time at the end of the logs, I see an error pointing to your mod:

[21:12:14] [Server thread/INFO]: ThreadedAnvilChunkStorage (Test): All chunks are saved
[21:12:14] [Server thread/INFO]: ThreadedAnvilChunkStorage: All dimensions are saved
[21:12:14] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[21:12:14] [Server thread/INFO]: ThreadedAnvilChunkStorage (otherside): All chunks are saved
[21:12:14] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[21:12:14] [Server thread/INFO]: closing rrp ebe:base_resources
[21:12:14] [Server thread/ERROR]: Exception stopping the server
java.lang.NullPointerException: Cannot invoke "com.dimitrodam.customlan.TunnelType.stop(net.minecraft.server.MinecraftServer)" because the return value of "net.minecraft.server.MinecraftServer.getTunnelType()" is null
	at net.minecraft.server.MinecraftServer.handler$cgj000$customlan$postShutdown(MinecraftServer.java:5313) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_3782(MinecraftServer.java:619) ~[client-intermediary.jar:?]
	at net.minecraft.class_1132.method_3782(class_1132.java:209) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:703) ~[client-intermediary.jar:?]
	at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) ~[client-intermediary.jar:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
[21:12:14] [Server thread/INFO]: [FastQuit] The world "Test" has been successfully saved. (1min 46s)
[21:12:14] [Render thread/INFO]: closing rrp ebe:base_resources

Apart from this error, everything works fine and I don't see any problems in the latest.log.
Moreover, this error occurs despite the fact that I didn't even open the world to the LAN. That is, I can literally enter the world, immediately exit it, and I still have to wait almost 2 minutes until this error is apparently forcibly terminated.
And yes, with version [1.20-1.20.1] Custom LAN 2.2.3 this error didn't occur.

1.20 is incompatible

Likely going to assume 1.20.1 may be doable aswell as it's currently similar to this version itself.

[Bug] Required for client

I want to be able to host my LAN game to my friends and not bother them with installing any of my mods. However, it doesn't let other players join the game without Custom LAN installed:
изображение

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.