mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
ConsoleCommandSender no longer has a default constructor, use ConsoleCommandSender(server). Added entity.getServer
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package org.bukkit.command;
|
package org.bukkit.command;
|
||||||
|
|
||||||
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
public interface CommandSender {
|
public interface CommandSender {
|
||||||
/**
|
/**
|
||||||
@@ -24,4 +26,11 @@ public interface CommandSender {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean isPlayer();
|
public boolean isPlayer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the server instance that this player is running through
|
||||||
|
*
|
||||||
|
* @return Server instance
|
||||||
|
*/
|
||||||
|
public Server getServer();
|
||||||
}
|
}
|
@@ -1,10 +1,18 @@
|
|||||||
|
|
||||||
package org.bukkit.command;
|
package org.bukkit.command;
|
||||||
|
|
||||||
|
import org.bukkit.Server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents CLI input from a console
|
* Represents CLI input from a console
|
||||||
*/
|
*/
|
||||||
public class ConsoleCommandSender implements CommandSender {
|
public class ConsoleCommandSender implements CommandSender {
|
||||||
|
private final Server server;
|
||||||
|
|
||||||
|
public ConsoleCommandSender(Server server) {
|
||||||
|
this.server = server;
|
||||||
|
}
|
||||||
|
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
System.out.println(message.replaceAll("(?i)\u00A7[0-F]", ""));
|
System.out.println(message.replaceAll("(?i)\u00A7[0-F]", ""));
|
||||||
}
|
}
|
||||||
@@ -16,4 +24,8 @@ public class ConsoleCommandSender implements CommandSender {
|
|||||||
public boolean isPlayer() {
|
public boolean isPlayer() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Server getServer() {
|
||||||
|
return server;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
package org.bukkit.entity;
|
package org.bukkit.entity;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,4 +69,11 @@ public interface Entity {
|
|||||||
* Mark the entity's removal.
|
* Mark the entity's removal.
|
||||||
*/
|
*/
|
||||||
public void remove();
|
public void remove();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link Server} that contains this Entity
|
||||||
|
*
|
||||||
|
* @return Server instance running this Entity
|
||||||
|
*/
|
||||||
|
public Server getServer();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user