@@ -46,7 +46,7 @@ public function onEnable(){
46
46
];
47
47
}
48
48
49
- public function onCommand (CommandSender $ sender , Command $ command , string $ label , array $ args ): bool {
49
+ public function onCommand (CommandSender $ sender , Command $ command , string $ label , array $ args ) : bool {
50
50
if (!$ sender ->isOp ()) return true ;
51
51
// 可変関数(コールバック関数)
52
52
$ callable = $ this ->commandHandler [strtolower (array_shift ($ args ))] ?? $ this ->commandHandler ["help " ];
@@ -115,9 +115,7 @@ public function onGiveCommand(CommandSender $sender, array $args){
115
115
$ item ->setCustomName ("警棒 " );
116
116
117
117
$ enchantment = Enchantment::getEnchantment (Enchantment::PROTECTION );
118
- if (strpos ((new \ReflectionClass ("pocketmine\item\Item " ))->getMethod ("addEnchantment " )->getParameters ()[0 ]->getClass ()->getName (), "EnchantmentInstance " )){
119
- $ enchantment = new \pocketmine \item \enchantment \EnchantmentInstance ($ enchantment , 1 );
120
- }
118
+ $ enchantment = new \pocketmine \item \enchantment \EnchantmentInstance ($ enchantment , 1 );
121
119
$ item ->addEnchantment ($ enchantment );
122
120
123
121
$ name = strtolower (implode (" " , $ args ));
@@ -146,9 +144,9 @@ public function onDamage(EntityDamageEvent $event){
146
144
$ player = $ event ->getEntity ();
147
145
$ item = $ damager ->getInventory ()->getItemInHand ();
148
146
if (
149
- $ damager instanceof Player && $ player instanceof Player &&
150
- $ item ->getId () === Item::STICK && $ item ->hasEnchantments () &&
151
- ($ damager ->isOp () || $ this ->moderators ->exists ($ damager ->getName (), true ))
147
+ $ damager instanceof Player && $ player instanceof Player
148
+ && $ item ->getId () === Item::STICK && $ item ->hasEnchantments ()
149
+ && ($ damager ->isOp () || $ this ->moderators ->exists ($ damager ->getName (), true ))
152
150
){
153
151
$ pos = $ this ->config ->get ("pos " );
154
152
$ pos = new Position ($ pos ["x " ], $ pos ["y " ] + 0.1 , $ pos ["z " ], $ this ->getServer ()->getLevelByName ($ pos ["world " ]));
0 commit comments