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

Use custom server icon, MOTD and gamemode #293

Merged
merged 8 commits into from
Apr 2, 2022
Merged
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
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -8,8 +8,13 @@ RUN ./gradlew build -x test
# Keep any changes made here strictly in sync with Dockerfile-local
FROM itzg/minecraft-server:java8
COPY --from=build /project/web/build/libs/*-all.jar /mods/
COPY minecraft-server/* /data-init/

ENV EULA=TRUE
ENV TYPE=SPONGEVANILLA
ENV SKIP_SERVER_PROPERTIES=true
EXPOSE 25565 25575 7070 8080
ENTRYPOINT [ "/start" ]
ENTRYPOINT [ "/data-init/start-custom" ]

# TODO When https://github.com/itzg/docker-minecraft-server/issues/1449,
# then "ENV ICON=/data-init/server-icon.png", but until then that's in the start-custom
7 changes: 6 additions & 1 deletion Dockerfile-local
Original file line number Diff line number Diff line change
@@ -2,8 +2,13 @@
# Keep any changes made here strictly in sync with Dockerfile
FROM itzg/minecraft-server:java8
COPY web/build/libs/*-all.jar /mods/
COPY minecraft-server/* /data-init/

ENV EULA=TRUE
ENV TYPE=SPONGEVANILLA
ENV SKIP_SERVER_PROPERTIES=true
EXPOSE 25565 25575 7070 8080
ENTRYPOINT [ "/start" ]
ENTRYPOINT [ "/data-init/start-custom" ]

# TODO When https://github.com/itzg/docker-minecraft-server/issues/1449,
# then "ENV ICON=/data-init/server-icon.png", but until then that's in the start-custom
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <a href="https://www.learn.study"><img src="logo/oasis.learn.study-Minecraft-Scratch-HighRes.png" width="100"/></a> minecraft-storeys-maker [![Build Status](https://travis-ci.com/OASIS-learn-study/minecraft-storeys-maker.svg?branch=master)](https://travis-ci.com/OASIS-learn-study/minecraft-storeys-maker)
# <a href="https://www.learn.study"><img src="logo/oasis.learn.study-Minecraft-Scratch-HighRes.png" width="100"/></a> minecraft-storeys-maker

Minecraft extension to make your own stories in, with and for Minecraft - it's like being a movie director!

3 changes: 3 additions & 0 deletions minecraft-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory contains configuration files for the Minecraft server, used by the `Dockerfile`.

The storeys server's plugin code is not here, but in `../web`.
Binary file added minecraft-server/server-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions minecraft-server/server.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
spawn-protection=0
max-tick-time=60000
query.port=25565
generator-settings=
sync-chunk-writes=true
force-gamemode=false
allow-nether=true
enforce-whitelist=false
gamemode=1
broadcast-console-to-ops=true
enable-query=false
player-idle-timeout=0
difficulty=0
spawn-monsters=false
broadcast-rcon-to-ops=true
op-permission-level=4
pvp=true
entity-broadcast-range-percentage=100
snooper-enabled=true
level-type=DEFAULT
hardcore=false
enable-status=true
enable-command-block=true
max-players=20
network-compression-threshold=256
resource-pack-sha1=
max-world-size=29999984
function-permission-level=2
rcon.port=25575
server-port=25565
texture-pack=
server-ip=
spawn-npcs=true
allow-flight=false
level-name=world
view-distance=10
resource-pack=
spawn-animals=true
white-list=false
rcon.password=minecraft
generate-structures=true
max-build-height=256
online-mode=true
level-seed=
prevent-proxy-connections=false
use-native-transport=true
enable-jmx-monitoring=false
enable-rcon=true
motd=\u00A7a\u00A7l/make\u00A7r your \u00A7bown\u00A7r Plugins/Mods, \u00A7l\u00A76with Scratch\!
7 changes: 7 additions & 0 deletions minecraft-server/start-custom
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euox pipefail

cp /data-init/server.properties /data/
cp /data-init/server-icon.png /data/

/start
Original file line number Diff line number Diff line change
@@ -18,6 +18,8 @@
*/
package ch.vorburger.minecraft.storeys.guard;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.entity.living.player.gamemode.GameMode;
@@ -32,22 +34,23 @@
*/
public class GuardGameModeJoinListener implements EventListener<Join> {

@Override
public void handle(Join joinEvent) throws Exception {
private static final Logger LOG = LoggerFactory.getLogger(GuardGameModeJoinListener.class);

@Override public void handle(Join joinEvent) throws Exception {
GameMode newGameMode = null;
Player player = joinEvent.getTargetEntity();
// NB: Order and use of if and not else if - because higher permission overrides lower...
// But beware that OPS on servers without permissions plugin (such as LuckPerms) have all permissions;
// therefore the last permission must be the one which we wants an OPS to have!
if (player.hasPermission("storeys.guard.adventure")) {
newGameMode = GameModes.ADVENTURE;
}
if (player.hasPermission("storeys.guard.creative")) {
newGameMode = GameModes.CREATIVE;
}
if (player.hasPermission("storeys.guard.survival")) {
newGameMode = GameModes.SURVIVAL;
}
if (newGameMode != null) {
player.offer(Keys.GAME_MODE, newGameMode);
LOG.info("Setting Player {} game mode to {} due to their storeys.guard.* permissions", player.getName(), newGameMode);
}
}