Skip to content

Commit

Permalink
fix(gamemode): 🐛 fix load_config_simple as MCDR api changed (fix #68)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnzhiZhang committed Dec 2, 2022
1 parent 373347c commit 2dd500e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gamemode/gamemode/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
import time
from math import ceil, floor
from typing import Optional, Any

from mcdreforged.api.types import PluginServerInterface, PlayerCommandSource
from mcdreforged.api.command import *
from mcdreforged.api.decorator import new_thread
from mcdreforged.api.utils import Serializable

import minecraft_data_api

DIMENSIONS = {
'0': 'minecraft:overworld',
'-1': 'minecraft:the_nether',
Expand Down Expand Up @@ -51,6 +50,7 @@ class Config(Serializable):

config: Config
data: dict
minecraft_data_api: Optional[Any]


def nether_to_overworld(x, z):
Expand All @@ -62,13 +62,14 @@ def overworld_to_nether(x, z):


def on_load(server: PluginServerInterface, old):
global data
global data, minecraft_data_api
permissions = server.load_config_simple(
'config.json',
default_config=DEFAULT_CONFIG,
target_class=Config
)
data = server.load_config_simple('data.json', default_config={})
data = server.load_config_simple('data.json')
minecraft_data_api = server.get_plugin_instance('minecraft_data_api')

server.register_help_message('!!spec help', 'Gamemode插件帮助')

Expand Down

0 comments on commit 2dd500e

Please sign in to comment.