Sfoglia il codice sorgente

Initial commit for minecraft

Steve Thielemann 7 anni fa
commit
60f864a5a9

+ 2 - 0
data/eula.txt

@@ -0,0 +1,2 @@
+# Generated via Docker on Wed Apr 26 01:49:59 UTC 2017
+eula=TRUE

+ 5 - 0
data/ops.txt

@@ -0,0 +1,5 @@
+notevil
+Beanzilla
+bugz
+
+

BIN
data/paperclip.jar


BIN
data/plugins/GriefPrevention.jar


+ 136 - 0
data/plugins/GriefPreventionData/config.yml

@@ -0,0 +1,136 @@
+# Default values are perfect for most servers.  If you want to customize and have a question, look for the answer here first: http://dev.bukkit.org/bukkit-plugins/grief-prevention/pages/setup-and-configuration/
+GriefPrevention:
+  SeaLevelOverrides:
+    world: -1
+    world_nether: -1
+    world_the_end: -1
+  Claims:
+    Mode:
+      world_the_end: Disabled
+      world: Survival
+      world_nether: Disabled
+    PreventTheft: true
+    ProtectCreatures: true
+    PreventButtonsSwitches: true
+    LockWoodenDoors: false
+    LockTrapDoors: false
+    LockFenceGates: true
+    EnderPearlsRequireAccessTrust: true
+    ProtectHorses: true
+    InitialBlocks: 100
+    Claim Blocks Accrued Per Hour:
+      Default: 100
+    Max Accrued Claim Blocks:
+      Default: 2000
+    Accrued Idle Threshold: 0
+    AbandonReturnRatio: 1.0
+    AutomaticNewPlayerClaimsRadius: 4
+    ExtendIntoGroundDistance: 5
+    MinimumWidth: 5
+    MinimumArea: 100
+    MaximumDepth: 0
+    InvestigationTool: STICK
+    ModificationTool: WOOD_SPADE
+    Expiration:
+      ChestClaimDays: 0
+      UnusedClaimDays: 0
+      AllClaims:
+        DaysInactive: 0
+        ExceptWhenOwnerHasTotalClaimBlocks: 10000
+        ExceptWhenOwnerHasBonusClaimBlocks: 5000
+      AutomaticNatureRestoration:
+        SurvivalWorlds: false
+    AllowTrappedInAdminClaims: false
+    MaximumNumberOfClaimsPerPlayer: 0
+    CreationRequiresWorldGuardBuildPermission: true
+    PortalGenerationRequiresPermission: false
+    VillagerTradingRequiresPermission: true
+    CommandsRequiringAccessTrust: /sethome
+    DeliverManuals: true
+    ManualDeliveryDelaySeconds: 30
+  Spam:
+    Enabled: true
+    LoginCooldownSeconds: 60
+    ChatSlashCommands: /me;/global;/local
+    WhisperSlashCommands: /tell;/pm;/r;/whisper;/msg
+    WarningMessage: Please reduce your noise level.  Spammers will be banned.
+    BanOffenders: true
+    BanMessage: Banned for spam.
+    AllowedIpAddresses: 1.2.3.4; 5.6.7.8
+    DeathMessageCooldownSeconds: 120
+    Logout Message Delay In Seconds: 0
+  PvP:
+    RulesEnabledInWorld:
+      world: false
+      world_nether: false
+      world_the_end: false
+    ProtectFreshSpawns: true
+    PunishLogout: true
+    CombatTimeoutSeconds: 15
+    AllowCombatItemDrop: false
+    BlockedSlashCommands: /home;/vanish;/spawn;/tpa
+    ProtectPlayersInLandClaims:
+      PlayerOwnedClaims: true
+      AdministrativeClaims: true
+      AdministrativeSubdivisions: true
+    AllowLavaDumpingNearOtherPlayers: true
+    AllowFlintAndSteelNearOtherPlayers: true
+    ProtectPetsOutsideLandClaims: false
+  Economy:
+    ClaimBlocksPurchaseCost: 0.0
+    ClaimBlocksSellValue: 0.0
+  ProtectItemsDroppedOnDeath:
+    PvPWorlds: false
+    NonPvPWorlds: true
+  BlockLandClaimExplosions: true
+  BlockSurfaceCreeperExplosions: true
+  BlockSurfaceOtherExplosions: true
+  LimitSkyTrees: true
+  LimitTreeGrowth: false
+  LimitPistonsToLandClaims: true
+  FireSpreads: false
+  FireDestroys: false
+  AdminsGetWhispers: true
+  AdminsGetSignNotifications: true
+  SmartBan: true
+  Mute New Players Using Banned Words: true
+  MaxPlayersPerIpAddress: 3
+  Siege:
+    Worlds: []
+    BreakableBlocks:
+    - DIRT
+    - GRASS
+    - LONG_GRASS
+    - COBBLESTONE
+    - GRAVEL
+    - SAND
+    - GLASS
+    - THIN_GLASS
+    - WOOD
+    - WOOL
+    - SNOW
+  EndermenMoveBlocks: false
+  SilverfishBreakBlocks: false
+  CreaturesTrampleCrops: false
+  RabbitsEatCrops: true
+  HardModeZombiesBreakDoors: false
+  Database:
+    URL: ''
+    UserName: ''
+    Password: ''
+  UseBanCommand: false
+  BanCommandPattern: ban %name% %reason%
+  Mods:
+    BlockIdsRequiringAccessTrust: []
+    BlockIdsRequiringContainerTrust:
+    - 99999:*:Example - ID 99999, all data values.
+    BlockIdsExplodable: []
+    PlayersIgnoringAllClaims: []
+  Abridged Logs:
+    Days To Keep: 7
+    Included Entry Types:
+      Social Activity: true
+      Suspicious Activity: true
+      Administrative Activity: false
+      Debug: false
+      Muted Chat Messages: false

BIN
data/plugins/HolographicDisplays.jar


+ 48 - 0
data/plugins/Unbreakable/config.yml

@@ -0,0 +1,48 @@
+Message on making unbreakable: true
+Message on enchant cancel: true
+Message on enchant: false
+
+Also repair: true
+
+Anvil enchant delay sec: 5
+Anvil enchant cost: 3
+
+Hide Unbreakable: false
+
+#
+# If not set, worldlists default to ALL
+# Enchanting worldlist:
+# - world
+# Lore unbreakable string: Unbreakable
+
+# Below is added to Unbreakable enchanted items
+# Enchant lore: 
+# - line 1
+# - line 2
+# - line 3
+# - line 4
+
+Protect armor: true
+Protect tools: true
+Protect weapons: true
+Protect elytra: true
+
+#
+# Following only effective if one or more of 'Protect *' set true
+#
+
+# Auto fix worldlist:
+# - world
+
+# No permissions check if this turned on
+Unbreakable on spawn: false
+# Permissions checked for these three
+Unbreakable on pickup: true
+#  Effective for tools and weapons, armor and elytra
+Unbreakable on hold: true
+# Checks entire player inventory
+Unbreakable on join: false
+# remove Unbreakable when entering world not in 'Auto fix worldlist', if it's been set
+Breakable on leave world: false
+
+

BIN
data/plugins/Unbreakable4-9.jar


BIN
data/server-icon.png


+ 44 - 0
data/server.properties

@@ -0,0 +1,44 @@
+#Minecraft server properties
+#Sat Oct 14 04:28:01 GMT 2017
+spawn-protection=16
+max-tick-time=60000
+query.port=25565
+generator-settings={"coalSize"\:25,"coalCount"\:20,"coalMinHeight"\:0,"coalMaxHeight"\:128,"ironSize"\:25,"ironCount"\:20,"ironMinHeight"\:0,"ironMaxHeight"\:127,"goldSize"\:23,"goldCount"\:16,"goldMinHeight"\:0,"goldMaxHeight"\:129,"diamondSize"\:16,"diamondCount"\:8,"diamondMinHeight"\:0,"diamondMaxHeight"\:80}
+force-gamemode=false
+allow-nether=true
+gamemode=0
+enable-query=false
+player-idle-timeout=0
+difficulty=1
+spawn-monsters=true
+op-permission-level=4
+pvp=false
+snooper-enabled=true
+level-type=CUSTOMIZED
+hardcore=false
+enable-command-block=true
+max-players=16
+network-compression-threshold=256
+resource-pack-sha1=
+max-world-size=29999984
+rcon.port=25575
+server-port=25565
+debug=false
+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=
+generate-structures=true
+max-build-height=256
+online-mode=false
+level-seed=
+prevent-proxy-connections=false
+use-native-transport=true
+enable-rcon=false
+motd=Bugz server (Paper) WOOT\!

+ 15 - 0
docker-compose.yml

@@ -0,0 +1,15 @@
+
+version: "2"
+
+services:
+  minecraft:
+    build: mc-java
+    ports:
+      - "25565:25565"
+    volumes:
+      - ./data:/home/minecraft
+    environment:
+      SERVER: paperclip.jar
+      # You need to edit the server.properties file
+      STARTUP: '-DIReallyKnowWhatIAmDoingISwear'
+ 

+ 40 - 0
mc-java/Dockerfile

@@ -0,0 +1,40 @@
+FROM openjdk:8-jre-alpine
+
+ADD launch.sh /launch-minecraft.sh
+ADD MCRcon/demo.py /demo.py
+ADD MCRcon/mcrcon.py /mcrcon.py
+
+WORKDIR /home/minecraft
+# ADD launch.sh /home/minecraft/launch.sh
+# ADD start-minecraft.sh /home/minecraft/start-minecraft.sh
+# ADD base.properties /home/minecraft/base.properties
+# ADD https://github.com/itzg/rcon-cli/releases/download/1.3/rcon-cli_linux_amd64 /usr/local/bin/rcon-cli
+
+# Ok, but I can do better with some python scripts.  :D
+# ADD ./rcon-cli_linux_amd64 /usr/local/bin/rcon-cli
+
+RUN apk add --no-cache su-exec python python-dev py2-pip tini bash \
+&& addgroup -g 1000 minecraft \
+&& adduser -D -u 1000 -G minecraft -h /home/minecraft minecraft \
+&& pip install mcstatus \
+&& apk del python-dev \
+&& rm -rf /var/cache/apk/* 
+
+# && chown minecraft:minecraft /home/minecraft/*
+
+# Oddly, mcstatus localhost ping fails/unable to resolve hostname.  
+
+HEALTHCHECK CMD mcstatus 127.0.0.1 ping
+
+EXPOSE 25565 25575
+
+VOLUME ["/home/minecraft"]
+ENTRYPOINT [ "tini", "--" ]
+# CMD ["/home/minecraft/launch.sh"]
+CMD ["/launch-minecraft.sh"]
+
+ENV UID=1000 GIU=1000 \
+  SERVER=server.jar \
+  JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" 
+
+

+ 24 - 0
mc-java/Dockerfile~

@@ -0,0 +1,24 @@
+FROM openjdk:8-jre-alpine
+
+WORKDIR /home/minecraft
+ADD launch.sh /home/minecraft/launch.sh
+ADD start-minecraft.sh /home/minecraft/start-minecraft.sh
+ADD base.properties /home/minecraft/base.properties
+
+RUN apk add --no-cache su-exec python python-dev py2-pip bash \
+&& addgroup -g 1000 minecraft \
+&& adduser -D -u 1000 -G minecraft -h /home/minecraft minecraft \
+&& pip install mcstatus \
+&& apk del python-dev \
+&& rm -rf /var/cache/apk/* \
+&& chown minecraft:minecraft /home/minecraft/*
+
+CMD ["/home/minecraft/launch.sh"]
+
+ENV UID=1000 GIU=1000 \
+  MOTD="A Minecraft Server running under Docker" \
+  LEVEL=world PVP=true \
+  SERVER=server.jar \
+  JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G"
+
+

+ 1 - 0
mc-java/MCRcon

@@ -0,0 +1 @@
+Subproject commit c557dbcd6d1ef7033b855d80e4d141bc4c92280b

+ 38 - 0
mc-java/base.properties

@@ -0,0 +1,38 @@
+op-permission-level=4
+allow-nether=true
+level-name=world
+enable-query=false
+allow-flight=false
+announce-player-achievements=true
+server-port=25565
+rcon.port=25575
+query.port=25565
+level-type=DEFAULT
+enable-rcon=false
+force-gamemode=false
+level-seed=
+server-ip=
+max-tick-time=60000
+max-build-height=256
+spawn-npcs=true
+white-list=false
+spawn-animals=true
+hardcore=false
+snooper-enabled=true
+texture-pack=
+online-mode=true
+resource-pack=
+pvp=true
+difficulty=1
+enable-command-block=true
+player-idle-timeout=0
+gamemode=0
+max-players=20
+spawn-monsters=true
+generate-structures=true
+view-distance=10
+spawn-protection=16
+motd=A Minecraft Server powered by Docker
+generator-settings=
+rcon.password=
+max-world-size=29999984

+ 58 - 0
mc-java/launch.sh

@@ -0,0 +1,58 @@
+#!/bin/bash
+
+# https://github.com/itzg/dockerfiles/blob/master/minecraft-server/start.sh
+
+set -e
+sed -i "/^minecraft/s/:1000:1000:/:${UID}:${GID}:/g" /etc/passwd
+sed -i "/^minecraft/s/:1000:/:${GID}:/g" /etc/group
+
+cd /home/minecraft
+
+if [ ! -e eula.txt ]; then
+  echo "# Generated via Docker at $(date)" > eula.txt
+  echo "eula=TRUE" >> eula.txt
+  chown ${UID}:${GID} eula.txt
+fi
+
+
+if [ ! -e server.properties ]; then
+  echo "Missing server.properties"
+  exit 99
+fi
+
+# create ops.txt file with the names
+
+# There whitelist code https://github.com/itzg/dockerfiles/blob/master/minecraft-server/start-minecraft.sh#L540
+# but it doesn't work.  See https://www.beastnode.com/portal/knowledgebase/6/Setting-Up-a-Whitelist-or-Make-Your-Server-Private.html
+# on using /whitelist add username (to actually setup and use the whitelist.json file)   :P
+
+if [ ! -e banned-players.json ]; then
+  echo '[]' > banned-players.json
+  chown ${UID}:${GID} banned-player.json
+fi
+
+if [ ! -e banned-ips.json ]; then
+  echo '[]' > banned-ips.json
+  chown ${UID}:${GID} banned-ips.json
+fi
+
+EXTRA_ARGS=""
+
+# Optional disable console
+if [[ ${CONSOLE} = false || ${CONSOLE} = FALSE ]]; then
+  EXTRA_ARGS+="--noconsole"
+fi
+
+# Optional disable GUI for headless servers
+if [[ ${GUI} = false || ${GUI} = FALSE ]]; then
+  EXTRA_ARGS="${EXTRA_ARGS} nogui"
+fi
+
+# put these prior JVM_OPTS at the end to give any memory settings there higher precedence
+echo "Setting initial memory to ${INIT_MEMORY:-${MEMORY}} and max to ${MAX_MEMORY:-${MEMORY}}"
+JVM_OPTS="-Xms${INIT_MEMORY:-${MEMORY}} -Xmx${MAX_MEMORY:-${MEMORY}} ${JVM_OPTS}"
+
+echo "Switching to user 'minecraft' and launching $SERVER"
+
+su-exec minecraft java $JVM_XX_OPTS $JVM_OPTS $STARTUP -jar $SERVER "$@" $EXTRA_ARGS
+

BIN
mc-java/rcon-cli_linux_amd64


+ 163 - 0
mc-java/start-minecraft.sh

@@ -0,0 +1,163 @@
+#!/bin/bash
+
+cd /home/minecraft
+
+# https://github.com/itzg/dockerfiles/blob/master/minecraft-server/start-minecraft.sh
+
+if [ ! -e eula.txt ]; then
+  if [ "$EULA" != "" ]; then
+    echo "# Generated via Docker at $(date)" > eula.txt
+    echo "eula=TRUE" >> eula.txt
+  else
+    echo "Accept the Minecraft EULA at"
+    echo "  https://account.mojang.com/documents/minecraft_eula"
+    echo "by adding -e EULA=TRUE"
+    exit 1
+  fi
+fi
+
+SERVER_PROPERTIES=server.properties
+
+function setProp {
+  local prop=$1
+  local var=$2
+  if [ -n "$var" ]; then
+    echo "Setting $prop to $var"
+    sed -i "/$prop\s*=/ c $prop=$var" server.properties
+  fi
+}
+
+if [ ! -e server.properties ]; then
+  echo "Creating server.properties"
+  cp base.properties server.properties
+  if [ -n "$WHITELIST" ]; then
+    echo "Whitelist enable. You need to create the whitelist.json maunally, or disable and add users with /whitelist nick"
+  fi
+
+  setProp "motd" "$MOTD"
+  setProp "allow-nether" "$ALLOW_NETHER"
+  setProp "announce-player-achievements" "$ANNOUNCE_PLAYER_ACHIEVEMENTS"
+  setProp "enable-command-block" "$ENABLE_COMMAND_BLOCK"
+  setProp "spawn-animals" "$SPAWN_ANIMAILS"
+  setProp "spawn-monsters" "$SPAWN_MONSTERS"
+  setProp "spawn-npcs" "$SPAWN_NPCS"
+  setProp "generate-structures" "$GENERATE_STRUCTURES"
+  setProp "spawn-npcs" "$SPAWN_NPCS"
+  setProp "view-distance" "$VIEW_DISTANCE"
+  setProp "hardcore" "$HARDCORE"
+  setProp "max-build-height" "$MAX_BUILD_HEIGHT"
+  setProp "force-gamemode" "$FORCE_GAMEMODE"
+  setProp "hardmax-tick-timecore" "$MAX_TICK_TIME"
+  setProp "enable-query" "$ENABLE_QUERY"
+  setProp "query.port" "$QUERY_PORT"
+  setProp "enable-rcon" "$ENABLE_RCON"
+  setProp "rcon.password" "$RCON_PASSWORD"
+  setProp "rcon.port" "$RCON_PORT"
+  setProp "max-players" "$MAX_PLAYERS"
+  setProp "max-world-size" "$MAX_WORLD_SIZE"
+  setProp "level-name" "$LEVEL"
+  setProp "level-seed" "$SEED"
+  setProp "pvp" "$PVP"
+  setProp "generator-settings" "$GENERATOR_SETTINGS"
+  setProp "online-mode" "$ONLINE_MODE"
+
+  if [ -n "$LEVEL_TYPE" ]; then
+    # uppercase
+    LEVEL_TYPE=$( echo ${LEVEL_TYPE} | tr '[:lower:]' '[:upper:]' )
+    echo "Setting level type to $LEVEL_TYPE"
+    case $LEVEL_TYPE in
+      DEFAULT|FLAT|LARGEBIOMES|AMPLIFIED|CUSTOMIZED|BIOMESOP)
+        setProp "level-type" "$LEVEL_TYPE"
+        ;;
+      *)
+        echo "Invalid LEVEL_TYPE: $LEVEL_TYPE"
+        echo "Try: DEFAULT FLAT LARGEBIOMES AMPLIFIED CUSTOMZED or BIOMESOP"
+        exit 1
+        ;;
+    esac
+  fi
+
+  if [ -n "$DIFFICULTY" ]; then
+    case $DIFFICULTY in
+      peaceful|0)
+        DIFFICULTY=0
+        ;;
+      easy|1)
+        DIFFICULTY=1
+        ;;
+      normal|2)
+        DIFFICULTY=2
+        ;;
+      hard|3)
+        DIFFICULTY=3
+        ;;
+      *)
+        echo "DIFFICULTY must be peaceful, easy, normal, or hard."
+        exit 1
+        ;;
+    esac
+    echo "Setting difficulty to $DIFFICULTY"
+    setProp "difficulty" "$DIFFICULTY"
+  fi
+
+  if [ -n "$MODE" ]; then
+    echo "Setting mode"
+    MODE_LC=$( echo $MODE | tr '[:upper:]' '[:lower:]' )
+    case $MODE_LC in
+      0|1|2|3)
+        ;;
+      su*)
+        MODE=0
+        ;;
+      c*)
+        MODE=1
+        ;;
+      a*)
+        MODE=2
+        ;;
+      sp*)
+        MODE=3
+        ;;
+      *)
+        echo "ERROR: Invalid game mode: $MODE"
+        exit 1
+        ;;
+    esac  
+    setProp "gamemode" "$MODE"
+  fi
+fi
+
+if [ -n "$OPS" -a ! -e ops.txt.converted ]; then
+  echo "Setting ops"
+  echo $OPS | awk -v RS=, '{print}' >> ops.txt
+fi
+
+# There whitelist code https://github.com/itzg/dockerfiles/blob/master/minecraft-server/start-minecraft.sh#L540
+# but it doesn't work.  See https://www.beastnode.com/portal/knowledgebase/6/Setting-Up-a-Whitelist-or-Make-Your-Server-Private.html
+# on using /whitelist add username (to actually setup and use the whitelist.json file)   :P
+
+if [ ! -e banned-players.json ]; then
+  echo '[]' > banned-players.json
+fi
+
+if [ ! -e banned-ips.json ]; then
+  echo '[]' > banned-ips.json
+fi
+
+EXTRA_ARGS=""
+# Optional disable console
+if [[ ${CONSOLE} = false || ${CONSOLE} = FALSE ]]; then
+  EXTRA_ARGS+="--noconsole"
+fi
+
+# Optional disable GUI for headless servers
+if [[ ${GUI} = false || ${GUI} = FALSE ]]; then
+  EXTRA_ARGS="${EXTRA_ARGS} nogui"
+fi
+
+# put these prior JVM_OPTS at the end to give any memory settings there higher precedence
+echo "Setting initial memory to ${INIT_MEMORY:-${MEMORY}} and max to ${MAX_MEMORY:-${MEMORY}}"
+JVM_OPTS="-Xms${INIT_MEMORY:-${MEMORY}} -Xmx${MAX_MEMORY:-${MEMORY}} ${JVM_OPTS}"
+
+exec java $JVM_XX_OPTS $JVM_OPTS -jar $SERVER "$@" $EXTRA_ARGS
+

+ 64 - 0
readme.md

@@ -0,0 +1,64 @@
+# Minecraft - docker-compose
+
+This is Minecraft, running under docker, using docker-compose.
+
+## Getting Started
+
+Edit docker-compose.yml
+Edit data/server.properties, data/ops.txt
+Edit data/plugins/ configurations...
+
+### Prerequisites
+
+Docker
+Possibly, docker configured to run as non-root
+
+https://docs.docker.com/engine/installation/linux/linux-postinstall/
+
+### Newer Server
+
+https://ci.destroystokyo.com/job/PaperSpigot/
+
+### Newer Plugins
+
+(need link)
+
+### Installing
+
+docker-compose build
+docker-compose up -d
+Or, if you're having errors starting up, just docker-compose up. 
+(Which will display the logs to the console.)
+
+## Deployment
+
+Edit docker-compose.yml file to chang the port.
+
+    ports:
+      - "25565:25565"
+
+This maps the external port (that everyone connects in on) to 25565.
+To use the external port 20065, you would use:
+
+    ports:
+      - "20065:25565"
+
+**Note: You'll need to include 20065 to connect to this non-standard server port.**
+
+## Authors
+
+* **Steve Thielemann** 
+
+## Acknowledgments
+
+* https://hub.docker.com/r/itzg/minecraft-server/
+
+For giving me my first taste of running minecraft server under docker.
+
+And for the headaches of updating that made me want to try to build my own image.
+
+My image shuts down correctly, and doesn't need SIG_KILL!
+
+
+
+