Skip to content

Commit

Permalink
fix command permissions
Browse files Browse the repository at this point in the history
add three permissions for command using
update README.md
  • Loading branch information
MiaoDaze committed Nov 27, 2022
1 parent 58ca9a9 commit eaf12ef
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# RinDeath
A minecraft plugin for 1.16.5.
A minecraft plugin for 1.16.5.
## 中文介绍
### 插件功能
在这个插件中,你可以通过设置启用坟墓选项。在非观察者玩家死亡后,会生成一个坟墓(通过CustomModelData实现)。在玩家死亡后,死亡玩家会变为观察者模式并在坟墓附近游荡。当有玩家复活死亡玩家时,死亡玩家可以原地复活。否则当复活时间过后,玩家将在出生点复活。
### 插件特色
可以设定三种剩余复活时间提示模式

可以选择使用指令复活或是使用物品复活
### 权限设置
```
rindeath.cmd.respawn -使用/rindeath respawn命令的权限
rindeath.cmd.revive -使用/rindeath revive命令的权限
rindeath.cmd.reviveitem -使用/rindeath reviveitem命令的权限
```
### 发现Bug或有改进意见请前往[Issues](https:/YakumoReddo/RinDeath/issues)提出
13 changes: 13 additions & 0 deletions src/com/satsukirin/RinDeath/RDCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.UUID;
import java.util.stream.Collectors;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
Expand Down Expand Up @@ -46,9 +47,17 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
}
Player player = (Player)sender;
if (args[0].equalsIgnoreCase("respawn")) {
if(!player.hasPermission("rindeath.cmd.respawn")) {
player.sendMessage(ChatColor.RED+"您没有使用此命令的权限!");
return true;
}
RDSecondThread.getInstance().removePlayer(player, true);
}
if(args[0].equalsIgnoreCase("reviveitem")) {
if( !player.hasPermission("rindeath.cmd.reviveitem")) {
player.sendMessage(ChatColor.RED+"您没有使用此命令的权限!");
return true;
}
if(player.getEquipment().getItemInMainHand().getType().equals(Material.AIR)) {
player.sendMessage("你尚未持有物品");
return true;
Expand All @@ -59,6 +68,10 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
handitem.setItemMeta(meta);
}
if(args[0].equalsIgnoreCase("revive")) {
if(!player.hasPermission("rindeath.cmd.revive")) {
player.sendMessage(ChatColor.RED+"您没有使用此命令的权限!");
return true;
}
RayTraceResult rtr= player.getWorld().rayTraceEntities(player.getEyeLocation(), player.getEyeLocation().getDirection(), 5,1.0,a -> a.getType().equals(EntityType.ARMOR_STAND));
if (rtr==null || rtr.getHitEntity()==null) {
player.sendMessage("你还没有选中玩家坟墓");
Expand Down
7 changes: 7 additions & 0 deletions src/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# 是否启用坟墓功能
enable: true
# 坟墓的模型id,默认为紫珀块方块
graveModel: 1025
# 剩余复活时间,单位: 秒
respawnTime: 60
# 灵魂游荡范围,直线距离
range: 10
# 提示模式,actionbar为物品栏上方的条
# bossbar为屏幕上方的boss条
# title为屏幕中间的标题
tipType: actionbar
21 changes: 19 additions & 2 deletions src/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: RinDeath
author: Yakumo_Reddo
version: 1.0.0
version: 1.0.1
main: com.satsukirin.RinDeath.RinDeath
api-version: 1.16
commands:
Expand All @@ -9,4 +9,21 @@ commands:
usage: /rind help
rindeath:
description: RinDeath.
usage: /rindeath help
usage: /rindeath help
permissions:
rindeath.cmd.respawn:
description: Allows respawn
default: true
rindeath.cmd.revive:
description: Allows revive command
default: op
rindeath.cmd.reviveitem:
description: Allows reviveitem command
default: op
rindeath.cmd.*:
description: Wildcard command permission
default: op
children:
rindeath.cmd.respawn: true
rindeath.cmd.revive: true
rindeath.cmd.reviveitem: true

0 comments on commit eaf12ef

Please sign in to comment.