This repository has been archived by the owner on May 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ebe6b0c
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Enaium-BlocklyNukkitMC | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python | ||
# -*- encoding: utf-8 -*- | ||
""" | ||
Project: PlayerTeleport | ||
----------------------------------------------------------- | ||
Copyright © 2020 | Enaium | All rights reserved. | ||
""" | ||
import cn.nukkit.Server as nk | ||
|
||
tpalist = set() | ||
|
||
manager.createCommand("tpa", u"传送到玩家", "tpa") | ||
|
||
|
||
def tpa(sender, args): | ||
alllist = server.getInstance().getOnlinePlayers().values().toArray() | ||
|
||
for element in alllist: | ||
if element.getName().lower().__eq__(args[0].lower()): | ||
tpalist.add(TPA(sender, args[0].lower())) | ||
server.getPlayer(args[0]).sendTip(u"玩家" + sender.getName() + u"想传送到你!") | ||
return | ||
sender.sendTip(u"玩家" + args[0] + "不在线!") | ||
|
||
|
||
manager.createCommand("tpaccept", u"接受传送", "tpaccept") | ||
|
||
|
||
def tpaccept(sender, args): | ||
alllist = server.getInstance().getOnlinePlayers().values().toArray() | ||
|
||
for tpaElement in tpalist: | ||
if sender.getName().lower().__eq__(tpaElement.play2.lower()): | ||
for allElement in alllist: | ||
if allElement.getName().lower().__eq__(tpaElement.play1.getName().lower()): | ||
allElement.teleport(sender) | ||
tpalist.remove(tpaElement) | ||
sender.sendTip(u"传送成功") | ||
return | ||
sender.sendTip(u"没有传送!") | ||
|
||
|
||
class TPA: | ||
def __init__(self, play1, play2): | ||
self.play1 = play1 | ||
self.play2 = play2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# PlayerTeleport | ||
|
||
## 指令 | ||
|
||
`/tpa <玩家名>` 请求传送到玩家 | ||
|
||
`/tpaccept` 接受传送 | ||
|