This commit is contained in:
Eoghanmc22 2020-06-21 18:59:40 -04:00
commit 0335f04135
6 changed files with 15 additions and 10 deletions

2
.github/README.md vendored
View File

@ -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.

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}
}