geforkt von Mirrors/Paper
Added the ability to access offline players & more reverse lookup fixes in Permissible.
By: Dinnerbone <dinnerbone@dinnerbone.com>
Dieser Commit ist enthalten in:
Ursprung
1d6801b8e6
Commit
498e63dbfa
@ -220,7 +220,11 @@ public final class Bukkit {
|
||||
server.shutdown();
|
||||
}
|
||||
|
||||
public int broadcast(String message, String permission) {
|
||||
public static int broadcast(String message, String permission) {
|
||||
return server.broadcast(message, permission);
|
||||
}
|
||||
|
||||
public static OfflinePlayer getOfflinePlayer(String name) {
|
||||
return server.getOfflinePlayer(name);
|
||||
}
|
||||
}
|
||||
|
@ -375,4 +375,14 @@ public interface Server {
|
||||
* @return Amount of users who received the message
|
||||
*/
|
||||
public int broadcast(String message, String permission);
|
||||
|
||||
/**
|
||||
* Gets the player by the given name, regardless if they are offline or online.
|
||||
*
|
||||
* This will return an object even if the player does not exist. To this method, all players will exist.
|
||||
*
|
||||
* @param name Name of the player to retrieve
|
||||
* @return OfflinePlayer object
|
||||
*/
|
||||
public OfflinePlayer getOfflinePlayer(String name);
|
||||
}
|
||||
|
@ -18,4 +18,11 @@ public interface CommandSender extends Permissible {
|
||||
* @return Server instance
|
||||
*/
|
||||
public Server getServer();
|
||||
|
||||
/**
|
||||
* Gets the name of this command sender
|
||||
*
|
||||
* @return Name of the sender
|
||||
*/
|
||||
public String getName();
|
||||
}
|
||||
|
@ -83,4 +83,8 @@ public class ConsoleCommandSender implements CommandSender {
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
return perm.getEffectivePermissions();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "CONSOLE";
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,27 @@
|
||||
package org.bukkit.command;
|
||||
|
||||
import org.bukkit.command.defaults.ReloadCommand;
|
||||
import org.bukkit.command.defaults.PluginsCommand;
|
||||
import org.bukkit.command.defaults.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import static org.bukkit.util.Java15Compat.Arrays_copyOfRange;
|
||||
|
||||
public final class SimpleCommandMap implements CommandMap {
|
||||
private final Map<String, Command> knownCommands = new HashMap<String, Command>();
|
||||
private final Set<String> aliases = new HashSet<String>();
|
||||
private final Server server;
|
||||
private static final Set<Command> fallbackCommands = new HashSet<Command>();
|
||||
|
||||
static {
|
||||
fallbackCommands.add(new ListCommand());
|
||||
fallbackCommands.add(new StopCommand());
|
||||
fallbackCommands.add(new SaveCommand());
|
||||
fallbackCommands.add(new SaveOnCommand());
|
||||
fallbackCommands.add(new SaveOffCommand());
|
||||
fallbackCommands.add(new OpCommand());
|
||||
fallbackCommands.add(new DeopCommand());
|
||||
}
|
||||
|
||||
public SimpleCommandMap(final Server server) {
|
||||
this.server = server;
|
||||
@ -114,16 +110,6 @@ public final class SimpleCommandMap implements CommandMap {
|
||||
return registerdPassedLabel;
|
||||
}
|
||||
|
||||
private Command getFallback(String label) {
|
||||
for (Command cmd : fallbackCommands) {
|
||||
if (label.startsWith(cmd.getName().toLowerCase())) {
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -136,9 +122,6 @@ public final class SimpleCommandMap implements CommandMap {
|
||||
|
||||
String sentCommandLabel = args[0].toLowerCase();
|
||||
Command target = getCommand(sentCommandLabel);
|
||||
if (target == null) {
|
||||
target = getFallback(sentCommandLabel);
|
||||
}
|
||||
if (target == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -9,13 +9,14 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Note;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.map.MapView;
|
||||
|
||||
/**
|
||||
* Represents a player, connected or not
|
||||
*
|
||||
*/
|
||||
public interface Player extends HumanEntity, OfflinePlayer {
|
||||
public interface Player extends HumanEntity, CommandSender, OfflinePlayer {
|
||||
/**
|
||||
* Gets the "friendly" name to display of this player. This may include color.
|
||||
*
|
||||
|
@ -159,7 +159,7 @@ public class PermissibleBase implements Permissible {
|
||||
dirtyPermissions = true;
|
||||
}
|
||||
|
||||
private synchronized void calculatePermissions() {
|
||||
public synchronized void calculatePermissions() {
|
||||
if (dirtyPermissions) {
|
||||
clearPermissions();
|
||||
Set<Permission> defaults = Bukkit.getServer().getPluginManager().getDefaultPermissions(isOp());
|
||||
|
@ -449,15 +449,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
|
||||
private void calculatePermissionDefault(Permission perm) {
|
||||
if (!perm.getChildren().isEmpty()) {
|
||||
if ((perm.getDefault() == PermissionDefault.OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
|
||||
defaultPerms.get(true).add(perm);
|
||||
dirtyPermissibles(true);
|
||||
}
|
||||
if ((perm.getDefault() == PermissionDefault.NOT_OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
|
||||
defaultPerms.get(false).add(perm);
|
||||
dirtyPermissibles(false);
|
||||
}
|
||||
if ((perm.getDefault() == PermissionDefault.OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
|
||||
defaultPerms.get(true).add(perm);
|
||||
dirtyPermissibles(true);
|
||||
}
|
||||
if ((perm.getDefault() == PermissionDefault.NOT_OP) || (perm.getDefault() == PermissionDefault.TRUE)) {
|
||||
defaultPerms.get(false).add(perm);
|
||||
dirtyPermissibles(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren