mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-03 23:17:48 +01:00
Merge branch 'master' of https://github.com/Minestom/Minestom
This commit is contained in:
commit
0335f04135
2
.github/README.md
vendored
2
.github/README.md
vendored
@ -62,7 +62,7 @@ It is our major concept, worlds are great for survival with friends, but when it
|
||||
|
||||
Being able to create instances directly on the go is a must-have, according to us it can push many more projects forward.
|
||||
|
||||
Instances also come with performance benefits, unlike some others which will be fully single-threaded or maybe using one thread per world we are using a set number of threads (pool) to manage all chunks independently from instances, meaning using more of CPU power.
|
||||
Instances also come with performance benefits, unlike some others which will be fully single-threaded or maybe using one thread per world we are using a set number of threads (pool) to manage all chunks independently from instances, meaning using more CPU power.
|
||||
|
||||
## Blocks
|
||||
Minestom by default does not know what is a chest, you will have to tell him that it opens an inventory.
|
||||
|
@ -23,7 +23,7 @@ public class DimensionCommand implements CommandProcessor {
|
||||
@Override
|
||||
public boolean process(CommandSender sender, String command, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player))
|
||||
if (!sender.isPlayer())
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class GamemodeCommand extends Command<CommandSender> {
|
||||
}
|
||||
|
||||
private boolean isAllowed(CommandSender sender) {
|
||||
if (!(sender instanceof Player)) {
|
||||
if (!sender.isPlayer()) {
|
||||
sender.sendMessage("The command is only available for player");
|
||||
return false;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class HealthCommand extends Command<CommandSender> {
|
||||
}
|
||||
|
||||
private boolean condition(CommandSender sender) {
|
||||
if (!(sender instanceof Player)) {
|
||||
if (!sender.isPlayer()) {
|
||||
sender.sendMessage("The command is only available for player");
|
||||
return false;
|
||||
}
|
||||
|
@ -1,16 +1,11 @@
|
||||
package fr.themode.demo.commands;
|
||||
|
||||
import com.extollit.gaming.ai.path.HydrazinePathFinder;
|
||||
import com.extollit.gaming.ai.path.model.PathObject;
|
||||
import com.extollit.linalg.immutable.Vec3i;
|
||||
import fr.themode.demo.entity.ChickenCreature;
|
||||
import net.minestom.server.command.CommandProcessor;
|
||||
import net.minestom.server.command.CommandSender;
|
||||
import net.minestom.server.entity.Player;
|
||||
import net.minestom.server.instance.Instance;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class SimpleCommand implements CommandProcessor {
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
@ -25,7 +20,7 @@ public class SimpleCommand implements CommandProcessor {
|
||||
@Override
|
||||
public boolean process(CommandSender sender, String command, String[] args) {
|
||||
|
||||
if (!(sender instanceof Player))
|
||||
if (!sender.isPlayer())
|
||||
return false;
|
||||
Player player = (Player) sender;
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package net.minestom.server.command;
|
||||
|
||||
import net.minestom.server.entity.Player;
|
||||
|
||||
public interface CommandSender {
|
||||
|
||||
void sendMessage(String message);
|
||||
@ -10,4 +12,12 @@ public interface CommandSender {
|
||||
}
|
||||
}
|
||||
|
||||
default boolean isPlayer() {
|
||||
return this instanceof Player;
|
||||
}
|
||||
|
||||
default boolean isConsole() {
|
||||
return this instanceof ConsoleSender;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user