13
0
geforkt von Mirrors/Paper

Update Bukkit for Minecraft 1.7.8

By: Travis Watkins <amaranth@ubuntu.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2014-04-10 20:06:14 -05:00
Ursprung 9581550637
Commit 07c1670354
9 geänderte Dateien mit 86 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.7.5-R0.1-SNAPSHOT</version> <version>1.7.8-R0.1-SNAPSHOT</version>
<name>Bukkit</name> <name>Bukkit</name>
<url>http://www.bukkit.org</url> <url>http://www.bukkit.org</url>

Datei anzeigen

@ -20,6 +20,10 @@ public interface BanList {
* Banned player IP addresses * Banned player IP addresses
*/ */
IP, IP,
/**
* Banned player UUID
*/
UUID,
; ;
} }

Datei anzeigen

@ -19,12 +19,12 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
/** /**
* Returns the name of this player * Returns the name of this player
* <p>
* Names are no longer unique past a single game session. For persistent storage
* it is recommended that you use {@link #getUniqueId()} instead.
* *
* @deprecated Use {@link #getUniqueId()} as player names are no longer * @return Player name or null if we have not seen a name for this player yet
* guaranteed to be unique
* @return Player name
*/ */
@Deprecated
public String getName(); public String getName();
/** /**

Datei anzeigen

@ -558,13 +558,17 @@ public interface Server extends PluginMessageRecipient {
* Gets the player by the given name, regardless if they are offline or * Gets the player by the given name, regardless if they are offline or
* online. * online.
* <p> * <p>
* This method may involve a blocking web request to get the UUID for the
* given name.
* <p>
* This will return an object even if the player does not exist. To this * This will return an object even if the player does not exist. To this
* method, all players will exist. * method, all players will exist.
* *
* @deprecated Use {@link #getOfflinePlayer(UUID)} as player names are no * @deprecated Persistent storage of users should be by UUID as names are no longer
* longer guaranteed to be unique * unique past a single session.
* @param name the name the player to retrieve * @param name the name the player to retrieve
* @return an offline player * @return an offline player
* @see #getOfflinePlayer(java.util.UUID)
*/ */
@Deprecated @Deprecated
public OfflinePlayer getOfflinePlayer(String name); public OfflinePlayer getOfflinePlayer(String name);
@ -611,6 +615,9 @@ public interface Server extends PluginMessageRecipient {
/** /**
* Gets a ban list for the supplied type. * Gets a ban list for the supplied type.
* <p>
* Bans by name are no longer supported and this method will return
* null when trying to request them. The replacement is bans by UUID.
* *
* @param type the type of list to fetch, cannot be null * @param type the type of list to fetch, cannot be null
* @return a ban list of the specified type * @return a ban list of the specified type

Datei anzeigen

@ -1,7 +1,10 @@
package org.bukkit.block; package org.bukkit.block;
import org.bukkit.OfflinePlayer;
import org.bukkit.SkullType; import org.bukkit.SkullType;
import java.util.UUID;
/** /**
* Represents a Skull * Represents a Skull
*/ */
@ -17,18 +20,43 @@ public interface Skull extends BlockState {
/** /**
* Gets the owner of the skull * Gets the owner of the skull
* *
* @return the owner of the skull * @return the owner of the skull or null if the profile does not have a name
* @deprecated Skulls no longer store player names, they store profiles
* @see #getPlayer()
*/ */
@Deprecated
public String getOwner(); public String getOwner();
/** /**
* Sets the owner of the skull * Does nothing
* *
* @param name the new owner of the skull * @param name the new owner of the skull
* @return true if the owner was successfully set * @return true if the owner was successfully set
* @deprecated Skulls no longer store player names, they store profiles
* @see #setPlayer(org.bukkit.OfflinePlayer)
*/ */
@Deprecated
public boolean setOwner(String name); public boolean setOwner(String name);
/**
* Gets the owner of the skull, if one exists
*
* @return the owner of the skull or null if this skull does not have an owner
*/
public OfflinePlayer getPlayer();
/**
* Sets the owner of the skull to this player
* <p>
* If the owner does not contain all the needed data for the skull a call to
* {@link #update()} may potentially involve a blocking web request to acquire
* the missing data.
*
* @param player the new owner of the skull
* @return true if the owner was successfully set
*/
public boolean setPlayer(OfflinePlayer player);
/** /**
* Gets the rotation of the skull in the world * Gets the rotation of the skull in the world
* *

Datei anzeigen

@ -29,10 +29,17 @@ public class BanCommand extends VanillaCommand {
return false; return false;
} }
String reason = args.length > 0 ? StringUtils.join(args, ' ', 1, args.length) : null;
Bukkit.getBanList(BanList.Type.NAME).addBan(args[0], reason, null, sender.getName());
Player player = Bukkit.getPlayer(args[0]); Player player = Bukkit.getPlayer(args[0]);
String uuid;
if (player != null) {
uuid = player.getUniqueId().toString();
} else {
uuid = sender.getServer().getOfflinePlayer(args[0]).getUniqueId().toString();
}
String reason = args.length > 0 ? StringUtils.join(args, ' ', 1, args.length) : null;
Bukkit.getBanList(BanList.Type.UUID).addBan(uuid, reason, null, sender.getName());
if (player != null) { if (player != null) {
player.kickPlayer("Banned by admin."); player.kickPlayer("Banned by admin.");
} }

Datei anzeigen

@ -2,12 +2,14 @@ package org.bukkit.command.defaults;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.BanEntry; import org.bukkit.BanEntry;
import org.bukkit.BanList; import org.bukkit.BanList;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.util.StringUtil; import org.bukkit.util.StringUtil;
@ -27,7 +29,7 @@ public class BanListCommand extends VanillaCommand {
public boolean execute(CommandSender sender, String currentAlias, String[] args) { public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true; if (!testPermission(sender)) return true;
BanList.Type banType = BanList.Type.NAME; BanList.Type banType = BanList.Type.UUID;
if (args.length > 0) { if (args.length > 0) {
if (args[0].equalsIgnoreCase("ips")) { if (args[0].equalsIgnoreCase("ips")) {
banType = BanList.Type.IP; banType = BanList.Type.IP;
@ -48,6 +50,19 @@ public class BanListCommand extends VanillaCommand {
message.append(", "); message.append(", ");
} }
} }
String output = banlist[x].getTarget();
if (banType == BanList.Type.UUID) {
try {
OfflinePlayer player = sender.getServer().getOfflinePlayer(UUID.fromString(output));
if (player.getName() != null) {
output = player.getName();
}
} catch (IllegalArgumentException ex) {
// We seem to have an invalid UUID, what do?
}
}
message.append(banlist[x].getTarget()); message.append(banlist[x].getTarget());
} }

Datei anzeigen

@ -30,7 +30,8 @@ public class PardonCommand extends VanillaCommand {
return false; return false;
} }
Bukkit.getBanList(BanList.Type.NAME).pardon(args[0]); String uuid = sender.getServer().getOfflinePlayer(args[0]).getUniqueId().toString();
Bukkit.getBanList(BanList.Type.UUID).pardon(uuid);
Command.broadcastCommandMessage(sender, "Pardoned " + args[0]); Command.broadcastCommandMessage(sender, "Pardoned " + args[0]);
return true; return true;
} }

Datei anzeigen

@ -1,11 +1,20 @@
package org.bukkit.entity; package org.bukkit.entity;
import java.util.UUID;
public interface AnimalTamer { public interface AnimalTamer {
/** /**
* This is the name of the specified AnimalTamer. * This is the name of the specified AnimalTamer.
* *
* @return The name to reference on tamed animals * @return The name to reference on tamed animals or null if a name cannot be obtained
*/ */
public String getName(); public String getName();
/**
* This is the UUID of the specified AnimalTamer.
*
* @return The UUID to reference on tamed animals
*/
public UUID getUniqueId();
} }