mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-27 10:12:04 -07:00
.github
Paper-MojangAPI
build-data
gradle
licenses
patches
api
API-for-creating-command-sender-which-forwards-feedb.patch
API-to-get-a-BlockState-without-a-snapshot.patch
Ability-to-apply-mending-to-XP-API.patch
Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch
Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch
Add-API-for-item-entity-health.patch
Add-API-for-quit-reason.patch
Add-API-for-resetting-a-single-score.patch
Add-API-methods-to-control-if-armour-stands-can-move.patch
Add-API-to-get-Material-from-Boats-and-Minecarts.patch
Add-API-to-get-exact-interaction-point-in-PlayerInte.patch
Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch
Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
Add-ArmorStand-Item-Meta.patch
Add-Ban-Methods-to-Player-Objects.patch
Add-BaseComponent-sendMessage-methods-to-CommandSend.patch
Add-BeaconEffectEvent.patch
Add-BellRevealRaiderEvent.patch
Add-BellRingEvent.patch
Add-Block-isValidTool.patch
Add-BlockBreakBlockEvent.patch
Add-BlockFailedDispenseEvent.patch
Add-BlockPreDispenseEvent.patch
Add-BlockSoundGroup-interface.patch
Add-Destroy-Speed-API.patch
Add-ElderGuardianAppearanceEvent.patch
Add-EntityBlockStorage-clearEntities.patch
Add-EntityDyeEvent-and-CollarColorable-interface.patch
Add-EntityInsideBlockEvent.patch
Add-EntityKnockbackByEntityEvent.patch
Add-EntityLoadCrossbowEvent.patch
Add-EntityTeleportEndGatewayEvent.patch
Add-EntityZapEvent.patch
Add-FastUtil-to-Bukkit.patch
Add-GS4-Query-event.patch
Add-GameEvent-tags.patch
Add-Git-information-to-version-command-on-startup.patch
Add-Heightmap-API.patch
Add-ItemFactory-getMonsterEgg-API.patch
Add-ItemStack-Recipe-API-helper-methods.patch
Add-ItemStackRecipeChoice-Draft-API.patch
Add-LivingEntity-clearActiveItem.patch
Add-LivingEntity-getTargetEntity.patch
Add-Material-Tags.patch
Add-MetadataStoreBase.removeAll-Plugin.patch
Add-Mob-Goal-API.patch
Add-Mob-lookAt-API.patch
Add-More-Creeper-API.patch
Add-OBSTRUCTED-reason-to-BedEnterResult.patch
Add-PaperRegistry.patch
Add-PhantomPreSpawnEvent.patch
Add-Player-Client-Options-API.patch
Add-PlayerArmorChangeEvent.patch
Add-PlayerAttackEntityCooldownResetEvent.patch
Add-PlayerConnectionCloseEvent.patch
Add-PlayerFlowerPotManipulateEvent.patch
Add-PlayerInitialSpawnEvent.patch
Add-PlayerItemCooldownEvent.patch
Add-PlayerItemFrameChangeEvent.patch
Add-PlayerJumpEvent.patch
Add-PlayerKickEvent-causes.patch
Add-PlayerLocaleChangeEvent.patch
Add-PlayerPostRespawnEvent.patch
Add-PlayerSetSpawnEvent.patch
Add-PlayerShearBlockEvent.patch
Add-PlayerSignCommandPreprocessEvent.patch
Add-PlayerUseUnknownEntityEvent.patch
Add-PrepareResultEvent-PrepareGrindstoneEvent.patch
Add-ProjectileCollideEvent.patch
Add-PufferFishStateChangeEvent.patch
Add-Raw-Byte-Entity-Serialization.patch
Add-Raw-Byte-ItemStack-Serialization.patch
Add-String-based-Action-Bar-API.patch
Add-StructuresLocateEvent.patch
Add-TNTPrimeEvent.patch
Add-TameableDeathMessageEvent.patch
Add-TargetHitEvent-API.patch
Add-ThrownEggHatchEvent.patch
Add-UnknownCommandEvent.patch
Add-WhitelistToggleEvent.patch
Add-World.getEntity-UUID-API.patch
Add-a-call-helper-to-Event.patch
Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch
Add-additional-open-container-api-to-HumanEntity.patch
Add-advancement-display-API.patch
Add-an-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch
Add-an-asterisk-to-legacy-API-plugins.patch
Add-and-implement-PlayerRecipeBookClickEvent.patch
Add-basic-Datapack-API.patch
Add-cause-to-Weather-ThunderChangeEvents.patch
Add-command-line-option-to-load-extra-plugin-jars-no.patch
Add-command-to-reload-permissions.yml-and-require-co.patch
Add-configuration-option-to-prevent-player-names-fro.patch
Add-critical-damage-API.patch
Add-dropLeash-variable-to-EntityUnleashEvent.patch
Add-effect-to-block-break-naturally.patch
Add-enchantWithLevels-API.patch
Add-entity-liquid-API.patch
Add-exception-reporting-event.patch
Add-extended-PaperServerListPingEvent.patch
Add-getComputedBiome-API.patch
Add-getI18NDisplayName-API.patch
Add-getMainThreadExecutor-to-BukkitScheduler.patch
Add-getNearbyXXX-methods-to-Location.patch
Add-getOfflinePlayerIfCached-String.patch
Add-getTPS-method.patch
Add-hand-to-bucket-events.patch
Add-handshake-event-to-allow-plugins-to-handle-clien.patch
Add-helpers-for-left-right-click-to-Action.patch
Add-ignore-discounts-API.patch
Add-isCollidable-methods-to-various-places.patch
Add-item-slot-convenience-methods.patch
Add-legacy-ping-support-to-PaperServerListPingEvent.patch
Add-methods-for-working-with-arrows-stuck-in-living-.patch
Add-methods-to-find-targets-for-lightning-strikes.patch
Add-methods-to-get-translation-keys.patch
Add-missing-block-data-mins-and-maxes.patch
Add-missing-effects.patch
Add-missing-team-sidebar-display-slots.patch
Add-moon-phase-API.patch
Add-more-Campfire-API.patch
Add-more-Evoker-API.patch
Add-more-LimitedRegion-API.patch
Add-more-WanderingTrader-API.patch
Add-more-Witch-API.patch
Add-more-Zombie-API.patch
Add-more-line-of-sight-methods.patch
Add-new-overload-to-PersistentDataContainer-has.patch
Add-openSign-method-to-HumanEntity.patch
Add-playPickupItemAnimation-to-LivingEntity.patch
Add-player-health-update-API.patch
Add-pre-unbreaking-amount-to-PlayerItemDamageEvent.patch
Add-raw-address-to-AsyncPlayerPreLoginEvent.patch
Add-ray-tracing-methods-to-LivingEntity.patch
Add-recipe-to-cook-events.patch
Add-sendOpLevel-API.patch
Add-sender-name-to-commands.yml-replacement.patch
Add-setMaxPlayers-API.patch
Add-setPlayerProfile-API-for-Skulls.patch
Add-source-block-constructor-and-getChangedBlockData.patch
Add-source-to-PlayerExpChangeEvent.patch
Add-spectator-target-events.patch
Add-sun-related-API.patch
Add-tick-times-API.patch
Add-view-distance-API.patch
Add-villager-reputation-API.patch
Add-workaround-for-plugins-modifying-the-parent-of-t.patch
Add-worldborder-events.patch
Added-EntityDamageItemEvent.patch
Added-PlayerBedFailEnterEvent.patch
Added-PlayerChangeBeaconEffectEvent.patch
Added-PlayerDeepSleepEvent.patch
Added-PlayerLecternPageChangeEvent.patch
Added-PlayerLoomPatternSelectEvent.patch
Added-PlayerStonecutterRecipeSelectEvent.patch
Added-PlayerTradeEvent.patch
Added-ServerResourcesReloadedEvent.patch
Added-Vanilla-Entity-Tags.patch
Added-WorldGameRuleChangeEvent.patch
Added-getHostname-to-AsyncPlayerPreLoginEvent.patch
Additional-Block-Material-API-s.patch
Additional-world.getNearbyEntities-API-s.patch
Adds-PlayerArmSwingEvent.patch
Adventure.patch
Allow-Blocks-to-be-accessed-via-a-long-key.patch
Allow-Reloading-of-Command-Aliases.patch
Allow-adding-items-to-BlockDropItemEvent.patch
Allow-delegation-to-vanilla-chunk-gen.patch
Allow-disabling-armour-stand-ticking.patch
Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch
Allow-plugins-to-use-SLF4J-for-logging.patch
Allow-setting-the-vex-s-summoner.patch
Allow-to-change-the-podium-of-the-EnderDragon.patch
Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch
Annotation-Test-changes.patch
AnvilDamageEvent.patch
Arrow-pickup-rule-API.patch
Async-Chunks-API.patch
AsyncTabCompleteEvent.patch
Attributes-API-for-item-defaults.patch
Automatically-disable-plugins-that-fail-to-load.patch
Basic-PlayerProfile-API.patch
Beacon-API-custom-effect-ranges.patch
BlockDestroyEvent.patch
Brand-support.patch
Bucketable-API.patch
Build-system-changes.patch
Cache-the-result-of-Material-isBlock.patch
Change-EnderEye-target-without-changing-other-things.patch
Change-the-reserved-channel-check-to-be-sensible.patch
Clarify-the-Javadocs-for-Entity.getEntitySpawnReason.patch
Close-Plugin-Class-Loaders-on-Disable.patch
Complete-resource-pack-API.patch
Configurable-sculk-sensor-listener-range.patch
Convert-project-to-Gradle.patch
Create-HoverEvent-from-ItemStack-Entity.patch
Custom-Potion-Mixes.patch
Custom-replacement-for-eaten-items.patch
Disable-Sync-Events-firing-Async-errors-during-shutd.patch
Display-warning-on-deprecated-recipe-API.patch
Dolphin-API.patch
Don-t-load-plugins-prefixed-with-a-dot.patch
Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch
Enable-multi-release-plugin-jars.patch
EnderDragon-Events.patch
Enderman.teleportRandomly.patch
EndermanAttackPlayerEvent.patch
EndermanEscapeEvent.patch
Entity-AddTo-RemoveFrom-World-Events.patch
Entity-Jump-API.patch
Entity-Origin-API.patch
Entity-fromMobSpawner.patch
Entity-getChunk-API.patch
Entity-getEntitySpawnReason.patch
Entity-isTicking.patch
Entity-powdered-snow-API.patch
EntityMoveEvent.patch
EntityPathfindEvent.patch
EntityRegainHealthEvent-isFastRegen-API.patch
EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch
EntityTransformedEvent.patch
Expand-ArmorStand-API.patch
Expand-Explosions-API.patch
Expand-Location-Manipulation-API.patch
Expand-World.spawnParticle-API-and-add-Builder.patch
Expand-the-Registry-API.patch
ExperienceOrbMergeEvent.patch
ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch
Expose-LivingEntity-hurt-direction.patch
Expose-MinecraftServer-isRunning.patch
Expose-Tracked-Players.patch
Expose-WorldBorder-isInBounds-Location-check.patch
Expose-attack-cooldown-methods-for-Player.patch
Expose-client-protocol-version-and-virtual-host.patch
Expose-furnace-minecart-push-values.patch
Expose-game-version.patch
Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch
Expose-protocol-version.patch
Expose-server-CommandMap.patch
Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch
Expose-the-internal-current-tick.patch
Expose-vanilla-BiomeProvider-from-WorldInfo.patch
Fill-Profile-Property-Events.patch
Fireworks-API-s.patch
Fix-NotePlayEvent.patch
Fix-Potion-toItemStack-swapping-the-extended-and-upg.patch
Fix-ServerListPingEvent-flagging-as-Async.patch
Fix-Spigot-annotation-mistakes.patch
Fix-issues-with-mob-conversion.patch
Fix-plugin-provides-load-order.patch
Fix-upstream-javadocs.patch
Freeze-Tick-Lock-API.patch
Furnace-RecipesUsed-API.patch
Get-entity-default-attributes.patch
Goat-ram-API.patch
Graduate-bungeecord-chat-API-from-spigot-subclasses.patch
Handle-plugin-prefixes-in-implementation-logging-con.patch
IllegalPacketEvent.patch
Implement-Keyed-on-World.patch
Implement-furnace-cook-speed-multiplier-API.patch
Implement-regenerateChunk.patch
Improve-Arrow-API.patch
Improve-death-events.patch
Improve-scoreboard-entries.patch
Improve-the-Saddle-API-for-Horses.patch
Increase-custom-payload-channel-message-size.patch
Introduce-beacon-activation-deactivation-events.patch
Inventory-close.patch
Inventory-getHolder-method-without-block-snapshot.patch
Inventory-removeItemAnySlot.patch
InventoryCloseEvent-Reason-API.patch
Item-Rarity-API.patch
Item-canEntityPickup.patch
Item-no-age-no-player-pickup.patch
ItemStack-API-additions-for-quantity-flags-lore.patch
ItemStack-editMeta.patch
ItemStack-getMaxItemUseDuration.patch
ItemStack-repair-check-API.patch
Left-handed-API.patch
List-all-missing-hard-depends-not-just-first.patch
LivingEntity-Hand-Raised-Item-Use-API.patch
LivingEntity-setKiller.patch
Location.isChunkLoaded-API.patch
Location.toBlockLocation-toCenterLocation.patch
LootTable-API.patch
Make-EntityUnleashEvent-cancellable.patch
Make-JavaPluginLoader-thread-safe.patch
Make-plugins-list-alphabetical.patch
Make-shield-blocking-delay-configurable.patch
Make-the-default-permission-message-configurable.patch
Material-API-additions.patch
Misc-Utils.patch
Missing-Entity-Behavior-API.patch
Mob-Pathfinding-API.patch
Mob-Spawner-API-Enhancements.patch
More-CommandBlock-API.patch
More-Enchantment-API.patch
More-Lidded-Block-API.patch
More-PotionEffectType-API.patch
More-Projectile-API.patch
More-World-API.patch
More-lightning-API.patch
Move-VehicleCollisionEvent-HandlerList-up.patch
Multi-Block-Change-API.patch
Multiple-Entries-with-Scoreboards.patch
Optimize-Hoppers.patch
Option-to-prevent-NBT-copy-in-smithing-recipes.patch
Paper-Utils.patch
Performance-Concurrency-Improvements-to-Permissions.patch
Player-Chunk-Load-Unload-Events.patch
Player-Tab-List-and-Title-APIs.patch
Player-affects-spawning-API.patch
Player-elytra-boost-API.patch
Player.setPlayerProfile-API.patch
PlayerAdvancementCriterionGrantEvent.patch
PlayerAttemptPickupItemEvent.patch
PlayerDeathEvent-getItemsToKeep.patch
PlayerDeathEvent-shouldDropExperience.patch
PlayerElytraBoostEvent.patch
PlayerLaunchProjectileEvent.patch
PlayerMoveEvent-Improvements.patch
PlayerNaturallySpawnCreaturesEvent.patch
PlayerPickupExperienceEvent.patch
PlayerPickupItemEvent-setFlyAtPlayer.patch
PlayerReadyArrowEvent.patch
PlayerTeleportEndGatewayEvent.patch
Potential-bed-API.patch
PotionEffect-clone-methods.patch
PreCreatureSpawnEvent.patch
PreSpawnerSpawnEvent.patch
Prioritise-own-classes-where-possible.patch
Profile-Lookup-Events.patch
ProfileWhitelistVerifyEvent.patch
Provide-Chunk-Coordinates-as-a-Long-API.patch
Provide-E-TE-Chunk-count-stat-methods.patch
Provide-a-useful-PluginClassLoader-toString.patch
RangedEntity-API.patch
Reduce-thread-synchronization-in-MetadataStoreBase.patch
Remove-deadlock-risk-in-firing-async-events.patch
Remove-upstream-snakeyaml-fix.patch
Return-chat-component-with-empty-text-instead-of-thr.patch
Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch
Server-Tick-Events.patch
Shoulder-Entities-Release-API.patch
SkeletonHorse-Additions.patch
Slime-Pathfinder-Events.patch
Spawn-Reason-API.patch
Stinger-API.patch
Support-cancellation-supression-of-EntityDismount-Ve.patch
Support-components-in-ItemMeta.patch
Support-hex-colors-in-getLastColors.patch
System-prop-for-default-config-comment-parsing.patch
Tameable-getOwnerUniqueId-API.patch
Timings-v2.patch
Turtle-API.patch
Update-Folder-Uses-Plugin-Name.patch
Use-ASM-for-event-executors.patch
Version-Command-2.0.patch
Villager-Restocks-API.patch
Villager-resetOffers.patch
Warn-on-strange-EventHandler-return-types.patch
WitchConsumePotionEvent.patch
WitchReadyPotionEvent.patch
WitchThrowPotionEvent.patch
WorldCreator-keepSpawnLoaded.patch
Zombie-API-breaking-doors.patch
add-DragonEggFormEvent.patch
add-RespawnFlags-to-PlayerRespawnEvent.patch
add-back-EntityPortalExitEvent.patch
add-consumeFuel-to-FurnaceBurnEvent.patch
add-get-set-drop-chance-to-EntityEquipment.patch
add-hand-to-BlockMultiPlaceEvent.patch
add-isDeeplySleeping-to-HumanEntity.patch
added-2-new-TargetReasons-for-1.16-mob-behavior.patch
added-PlayerNameEntityEvent.patch
additions-to-PlayerGameModeChangeEvent.patch
ensureServerConversions-API.patch
fix-empty-array-elements-in-command-arguments.patch
getPlayerUniqueId-API.patch
isChunkGenerated-API.patch
living-entity-allow-attribute-registration.patch
server
scripts
test-plugin
work
.editorconfig
.gitattributes
.gitignore
.gitmodules
CONTRIBUTING.md
LICENSE.md
README.md
build.gradle.kts
gradle.properties
gradlew
gradlew.bat
settings.gradle.kts
todo.txt
383 lines
15 KiB
Diff
383 lines
15 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Tue, 11 Aug 2020 19:17:46 +0200
|
|
Subject: [PATCH] Add methods to get translation keys
|
|
|
|
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
|
|
|
|
diff --git a/src/main/java/org/bukkit/Difficulty.java b/src/main/java/org/bukkit/Difficulty.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/Difficulty.java
|
|
+++ b/src/main/java/org/bukkit/Difficulty.java
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
|
/**
|
|
* Represents the various difficulty levels that are available.
|
|
*/
|
|
-public enum Difficulty {
|
|
+public enum Difficulty implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
|
/**
|
|
* Players regain health over time, hostile mobs don't spawn, the hunger
|
|
* bar does not deplete.
|
|
@@ -0,0 +0,0 @@ public enum Difficulty {
|
|
return value;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public @org.jetbrains.annotations.NotNull String translationKey() {
|
|
+ return "options.difficulty." + this.name().toLowerCase(java.util.Locale.ENGLISH);
|
|
+ }
|
|
+ // Paper end
|
|
/**
|
|
* Gets the Difficulty represented by the specified value
|
|
*
|
|
diff --git a/src/main/java/org/bukkit/FireworkEffect.java b/src/main/java/org/bukkit/FireworkEffect.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/FireworkEffect.java
|
|
+++ b/src/main/java/org/bukkit/FireworkEffect.java
|
|
@@ -0,0 +0,0 @@ public final class FireworkEffect implements ConfigurationSerializable {
|
|
/**
|
|
* The type or shape of the effect.
|
|
*/
|
|
- public enum Type {
|
|
+ public enum Type implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
|
/**
|
|
* A small ball effect.
|
|
*/
|
|
- BALL,
|
|
+ BALL("small_ball"), // Paper - add name
|
|
/**
|
|
* A large ball effect.
|
|
*/
|
|
- BALL_LARGE,
|
|
+ BALL_LARGE("large_ball"), // Paper - add name
|
|
/**
|
|
* A star-shaped effect.
|
|
*/
|
|
- STAR,
|
|
+ STAR("star"), // Paper - add name
|
|
/**
|
|
* A burst effect.
|
|
*/
|
|
- BURST,
|
|
+ BURST("burst"), // Paper - add name
|
|
/**
|
|
* A creeper-face effect.
|
|
*/
|
|
- CREEPER,
|
|
+ CREEPER("creeper"), // Paper - add name
|
|
;
|
|
+ // Paper start
|
|
+ /**
|
|
+ * The name map.
|
|
+ */
|
|
+ public static final net.kyori.adventure.util.Index<String, org.bukkit.FireworkEffect.Type> NAMES = net.kyori.adventure.util.Index.create(Type.class, type -> type.name);
|
|
+ private final String name;
|
|
+
|
|
+ Type(final String name) {
|
|
+ this.name = name;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public @NotNull String translationKey() {
|
|
+ return "item.minecraft.firework_star.shape." + this.name;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
/**
|
|
diff --git a/src/main/java/org/bukkit/GameRule.java b/src/main/java/org/bukkit/GameRule.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/GameRule.java
|
|
+++ b/src/main/java/org/bukkit/GameRule.java
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
|
*
|
|
* @param <T> type of rule (Boolean or Integer)
|
|
*/
|
|
-public final class GameRule<T> {
|
|
+public final class GameRule<T> implements net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
|
|
|
private static Map<String, GameRule<?>> gameRules = new HashMap<>();
|
|
// Boolean rules
|
|
@@ -0,0 +0,0 @@ public final class GameRule<T> {
|
|
public static GameRule<?>[] values() {
|
|
return gameRules.values().toArray(new GameRule<?>[gameRules.size()]);
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public @NotNull String translationKey() {
|
|
+ return "gamerule." + this.name;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/Material.java
|
|
+++ b/src/main/java/org/bukkit/Material.java
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
|
* An enum of all material IDs accepted by the official server and client
|
|
*/
|
|
@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper
|
|
-public enum Material implements Keyed {
|
|
+public enum Material implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
|
|
//<editor-fold desc="Materials" defaultstate="collapsed">
|
|
AIR(9648, 0),
|
|
STONE(22948),
|
|
@@ -0,0 +0,0 @@ public enum Material implements Keyed {
|
|
}
|
|
return false;
|
|
}
|
|
+
|
|
+ /**
|
|
+ * Return the translation key for the Material, so the client can translate it into the active
|
|
+ * locale when using a TranslatableComponent.
|
|
+ * @return the translation key
|
|
+ * @deprecated use {@link #translationKey()}
|
|
+ */
|
|
+ @NotNull
|
|
+ @Deprecated
|
|
+ public String getTranslationKey() {
|
|
+ return this.translationKey();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public @NotNull String translationKey() {
|
|
+ return Bukkit.getUnsafe().getTranslationKey(this);
|
|
+ }
|
|
// Paper end
|
|
|
|
/**
|
|
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
|
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
|
byte[] serializeItem(ItemStack item);
|
|
|
|
ItemStack deserializeItem(byte[] data);
|
|
+
|
|
+ /**
|
|
+ * Return the translation key for the Material, so the client can translate it into the active
|
|
+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.
|
|
+ * @return the translation key
|
|
+ */
|
|
+ String getTranslationKey(Material mat);
|
|
+
|
|
+ /**
|
|
+ * Return the translation key for the Block, so the client can translate it into the active
|
|
+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.
|
|
+ * @return the translation key
|
|
+ */
|
|
+ String getTranslationKey(org.bukkit.block.Block block);
|
|
+
|
|
+ /**
|
|
+ * Return the translation key for the EntityType, so the client can translate it into the active
|
|
+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.<br>
|
|
+ * This is <code>null</code>, when the EntityType isn't known to NMS (custom entities)
|
|
+ * @return the translation key
|
|
+ */
|
|
+ String getTranslationKey(org.bukkit.entity.EntityType type);
|
|
+
|
|
+ /**
|
|
+ * Return the translation key for the ItemStack, so the client can translate it into the active
|
|
+ * locale when using a {@link net.kyori.adventure.text.TranslatableComponent}.<br>
|
|
+ * @return the translation key
|
|
+ */
|
|
+ String getTranslationKey(ItemStack itemStack);
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/attribute/Attribute.java
|
|
+++ b/src/main/java/org/bukkit/attribute/Attribute.java
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
|
|
/**
|
|
* Types of attributes which may be present on an {@link Attributable}.
|
|
*/
|
|
-public enum Attribute implements Keyed {
|
|
+public enum Attribute implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
|
|
|
/**
|
|
* Maximum health of an Entity.
|
|
@@ -0,0 +0,0 @@ public enum Attribute implements Keyed {
|
|
public NamespacedKey getKey() {
|
|
return key;
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public @NotNull String translationKey() {
|
|
+ return "attribute.name." + this.key.getKey();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/block/Block.java
|
|
+++ b/src/main/java/org/bukkit/block/Block.java
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
|
* (i.e. lighting and power) may not be able to be safely accessed during world
|
|
* generation when used in cases like BlockPhysicsEvent!!!!
|
|
*/
|
|
-public interface Block extends Metadatable {
|
|
+public interface Block extends Metadatable, net.kyori.adventure.translation.Translatable { // Paper - translatable
|
|
|
|
/**
|
|
* Gets the metadata for this block
|
|
@@ -0,0 +0,0 @@ public interface Block extends Metadatable {
|
|
* @return the sound group for this block
|
|
*/
|
|
@NotNull org.bukkit.SoundGroup getBlockSoundGroup();
|
|
+
|
|
+ /**
|
|
+ * Return the translation key for the Block, so the client can translate it into the active
|
|
+ * locale when using a TranslatableComponent.
|
|
+ * @return the translation key
|
|
+ * @deprecated use {@link #translationKey()}
|
|
+ */
|
|
+ @NotNull
|
|
+ @Deprecated
|
|
+ String getTranslationKey();
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
|
|
+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
|
/**
|
|
* The various type of enchantments that may be added to armour or weapons
|
|
*/
|
|
-public abstract class Enchantment implements Keyed {
|
|
+public abstract class Enchantment implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
|
/**
|
|
* Provides protection against environmental damage
|
|
*/
|
|
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
|
|
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java
|
|
@@ -0,0 +0,0 @@ public class EnchantmentWrapper extends Enchantment {
|
|
public net.kyori.adventure.text.Component displayName(int level) {
|
|
return getEnchantment().displayName(level);
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public @NotNull String translationKey() {
|
|
+ return getEnchantment().translationKey();
|
|
+ }
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/EntityType.java b/src/main/java/org/bukkit/entity/EntityType.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/entity/EntityType.java
|
|
+++ b/src/main/java/org/bukkit/entity/EntityType.java
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Contract;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
-public enum EntityType implements Keyed {
|
|
+public enum EntityType implements Keyed, net.kyori.adventure.translation.Translatable { // Paper - translatable
|
|
|
|
// These strings MUST match the strings in nms.EntityTypes and are case sensitive.
|
|
/**
|
|
@@ -0,0 +0,0 @@ public enum EntityType implements Keyed {
|
|
public boolean isAlive() {
|
|
return living;
|
|
}
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Return the translation key for the EntityType, so the client can translate it into the active
|
|
+ * locale when using a TranslatableComponent.<br>
|
|
+ * This is <code>null</code>, when the EntityType isn't known to NMS (custom entities)
|
|
+ * @return the translation key
|
|
+ * @deprecated use {@link #translationKey()}
|
|
+ */
|
|
+ @Deprecated
|
|
+ @Nullable
|
|
+ public String getTranslationKey() {
|
|
+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @throws IllegalArgumentException if the entity does not have a translation key (is probably a custom entity)
|
|
+ */
|
|
+ @Override
|
|
+ public @NotNull String translationKey() {
|
|
+ Preconditions.checkArgument(this != UNKNOWN, "UNKNOWN entities do not have translation keys");
|
|
+ return org.bukkit.Bukkit.getUnsafe().getTranslationKey(this);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/entity/Villager.java
|
|
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
|
@@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager {
|
|
* Represents the various different Villager professions there may be.
|
|
* Villagers have different trading options depending on their profession,
|
|
*/
|
|
- public enum Profession implements Keyed {
|
|
+ public enum Profession implements Keyed, net.kyori.adventure.translation.Translatable { // Paper
|
|
NONE,
|
|
/**
|
|
* Armorer profession. Wears a black apron. Armorers primarily trade for
|
|
@@ -0,0 +0,0 @@ public interface Villager extends AbstractVillager {
|
|
public NamespacedKey getKey() {
|
|
return key;
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public @NotNull String translationKey() {
|
|
+ return "entity.minecraft.villager." + this.key.getKey();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
// Paper start - Add villager reputation API
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
|
* use this class to encapsulate Materials for which {@link Material#isItem()}
|
|
* returns false.</b>
|
|
*/
|
|
-public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper
|
|
+public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem>, net.kyori.adventure.translation.Translatable { // Paper
|
|
private Material type = Material.AIR;
|
|
private int amount = 0;
|
|
private MaterialData data = null;
|
|
@@ -0,0 +0,0 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
|
ItemMeta itemMeta = getItemMeta();
|
|
return itemMeta != null && itemMeta.hasItemFlag(flag);
|
|
}
|
|
+
|
|
+ /**
|
|
+ * Gets the translation key for this itemstack.
|
|
+ * This is not the same as getting the translation key
|
|
+ * for the material of this itemstack.
|
|
+ *
|
|
+ * @return the translation key
|
|
+ * @deprecated use {@link #translationKey()}
|
|
+ */
|
|
+ @NotNull
|
|
+ @Deprecated
|
|
+ public String getTranslationKey() {
|
|
+ return this.translationKey();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * {@inheritDoc}
|
|
+ * <p>
|
|
+ * This is not the same as getting the translation key
|
|
+ * for the material of this itemstack.
|
|
+ */
|
|
+ @Override
|
|
+ public @NotNull String translationKey() {
|
|
+ return Bukkit.getUnsafe().getTranslationKey(this);
|
|
+ }
|
|
// Paper end
|
|
}
|