-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGiveClock.py
37 lines (33 loc) · 1.43 KB
/
GiveClock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import mc
import datetime
import json
import os
path = "plugins/GiveClock/"
folder = os.path.exists(path)
if not folder:
os.makedirs(path)
if not os.path.exists("plugins/GiveClock/deploy.txt"):
open("plugins/GiveClock/deploy.txt",'w')
def qingyi_join(e):
with open('plugins/GiveClock/deploy.txt', 'r') as f:
t=f.read()
name = e.name
if name in t:
print('[GiveClock] >>玩家已领取过!')
else:
e.addItem('{"Count1":1,"Damage2":0,"Name8":"minecraft:clock","WasPickedUp1":0,"tag10":{"minecraft:item_lock1" : 2,"minecraft:keep_on_death1" : 1,"RepairCost3":3,"display10":{"Name8":"钟表菜单"},"ench9":[]}}')
file = 'plugins/GiveClock/deploy.txt'
with open(file, 'a+') as f:
f.write(e.name+'\n')
def qingyi_uitem(e):
playdata = e["player"].getAllItem()
jsondata = json.loads(playdata)
je = jsondata["Hand"]
pd = json.dumps(je)
if "\\u949f\\u8868\\u83dc\\u5355"in pd:
if e["blockname"] == "minecraft:frame" or e["blockname"] == "minecraft:glow_frame":
if je["Name8"] == "minecraft:clock" and je["tag10"]["display10"]["Name8"] == "钟表菜单":
return False
mc.setListener('onUseItem',qingyi_uitem)
mc.setListener('onRespawn', qingyi_join)
print('['+datetime.datetime.now().strftime('%F %T')+' INFO] [GiveClock] >>插件加载成功,当前版本:V0.0.2!')