Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52c1b52f6d | ||
|
|
f321296227 | ||
|
|
ddd12db420 | ||
|
|
bd09791b5b |
@@ -126,14 +126,19 @@ abstract class HandledCommand(
|
||||
* @return The tab completion results.
|
||||
*/
|
||||
private fun CommandBase.handleTabComplete(sender: CommandSender, args: List<String>): List<String> {
|
||||
if (!sender.hasPermission(permission)) return emptyList()
|
||||
if (!sender.hasPermission(permission)) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
if (args.size == 1) {
|
||||
val completions = subcommands.filter { sender.hasPermission(it.permission) }.map { it.name }
|
||||
val completions = mutableListOf<String>()
|
||||
|
||||
val list = mutableListOf<String>()
|
||||
StringUtil.copyPartialMatches(
|
||||
args[0],
|
||||
subcommands.filter { sender.hasPermission(it.permission) }.map { it.name },
|
||||
completions
|
||||
)
|
||||
|
||||
StringUtil.copyPartialMatches(args[0], completions, list)
|
||||
if (completions.isNotEmpty()) {
|
||||
return completions
|
||||
}
|
||||
@@ -156,9 +161,11 @@ abstract class HandledCommand(
|
||||
}
|
||||
|
||||
val completions = tabComplete(sender, args).toMutableList()
|
||||
|
||||
if (sender is Player) {
|
||||
completions.addAll(tabComplete(sender, args))
|
||||
}
|
||||
|
||||
return completions.sorted()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry
|
||||
import org.bukkit.inventory.ItemStack
|
||||
import org.bukkit.persistence.PersistentDataContainer
|
||||
import org.bukkit.persistence.PersistentDataType
|
||||
import java.lang.reflect.Field
|
||||
|
||||
class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFactoryProxy {
|
||||
private val registry: CraftPersistentDataTypeRegistry
|
||||
@@ -21,7 +22,15 @@ class ExtendedPersistentDataContainerFactory : ExtendedPersistentDataContainerFa
|
||||
*/
|
||||
val item = CraftItemStack.asCraftCopy(ItemStack(Material.STONE))
|
||||
val pdc = item.itemMeta!!.persistentDataContainer
|
||||
this.registry = CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
||||
|
||||
// Cross-version compatibility:
|
||||
val registryField: Field = try {
|
||||
CraftPersistentDataContainer::class.java.getDeclaredField("registry")
|
||||
} catch (e: NoSuchFieldException) {
|
||||
CraftPersistentDataContainer::class.java.superclass.getDeclaredField("registry")
|
||||
}
|
||||
|
||||
this.registry = registryField
|
||||
.apply { isAccessible = true }.get(pdc) as CraftPersistentDataTypeRegistry
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 6.71.4
|
||||
version = 6.71.5
|
||||
kotlin.incremental.useClasspathSnapshot=false
|
||||
Reference in New Issue
Block a user