mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-22 16:05:03 +00:00
Correct lang + replacement mistake with inventory names
This commit is contained in:
parent
a1b2df74cc
commit
34e7252d77
4 changed files with 13 additions and 13 deletions
|
@ -190,19 +190,16 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||
String title;
|
||||
if (inventory instanceof SpecialEnderChest) {
|
||||
HumanEntity owner = (HumanEntity) ((SpecialEnderChest) inventory).getBukkitOwner();
|
||||
title = OpenInv.getPlugin(OpenInv.class).getLocalizedMessage(player, "container.enderchest");
|
||||
title = OpenInv.getPlugin(OpenInv.class).getLocalizedMessage(player, "container.enderchest", "%player%", owner.getName());
|
||||
if (title == null) {
|
||||
title = "%player%'s Ender Chest";
|
||||
title = owner.getName() + "'s Ender Chest";
|
||||
}
|
||||
//noinspection ConstantConditions - owner name can be null if loaded by UUID
|
||||
title = title.replace("%player%", owner.getName() != null ? owner.getName() : owner.getUniqueId().toString());
|
||||
} else if (inventory instanceof SpecialPlayerInventory) {
|
||||
EntityHuman owner = ((PlayerInventory) inventory).player;
|
||||
title = OpenInv.getPlugin(OpenInv.class).getLocalizedMessage(player, "container.player");
|
||||
title = OpenInv.getPlugin(OpenInv.class).getLocalizedMessage(player, "container.player", "%player%", owner.getName());
|
||||
if (title == null) {
|
||||
title = "%player%'s Inventory";
|
||||
title = owner.getName() + "'s Inventory";
|
||||
}
|
||||
title = title.replace("%player%", owner.getName() != null ? owner.getName() : owner.getUniqueID().toString());
|
||||
} else {
|
||||
return player.openInventory(inventory.getBukkitInventory());
|
||||
}
|
||||
|
|
|
@ -192,17 +192,16 @@ public class PlayerDataManager implements IPlayerDataManager {
|
|||
String title;
|
||||
if (inventory instanceof SpecialEnderChest) {
|
||||
HumanEntity owner = (HumanEntity) ((SpecialEnderChest) inventory).getBukkitOwner();
|
||||
title = OpenInv.getPlugin(OpenInv.class).getLocalizedMessage(player, "container.enderchest");
|
||||
title = OpenInv.getPlugin(OpenInv.class).getLocalizedMessage(player, "container.enderchest", "%player%", owner.getName());
|
||||
if (title == null) {
|
||||
title = "%player%'s Ender Chest";
|
||||
title = owner.getName() + "'s Ender Chest";
|
||||
}
|
||||
} else if (inventory instanceof SpecialPlayerInventory) {
|
||||
EntityHuman owner = ((PlayerInventory) inventory).player;
|
||||
title = OpenInv.getPlugin(OpenInv.class).getLocalizedMessage(player, "container.player");
|
||||
title = OpenInv.getPlugin(OpenInv.class).getLocalizedMessage(player, "container.player", "%player%", owner.getName());
|
||||
if (title == null) {
|
||||
title = "%player%'s Inventory";
|
||||
title = owner.getName() + "'s Inventory";
|
||||
}
|
||||
title = title.replace("%player%", owner.getName() != null ? owner.getName() : owner.getUniqueID().toString());
|
||||
} else {
|
||||
return player.openInventory(inventory.getBukkitInventory());
|
||||
}
|
||||
|
|
|
@ -313,6 +313,10 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
|
|||
return this.languageManager.getValue(key, getLocale(sender));
|
||||
}
|
||||
|
||||
public @Nullable String getLocalizedMessage(@NotNull CommandSender sender, @NotNull String key, String... replacements) {
|
||||
return this.languageManager.getValue(key, getLocale(sender), replacements);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getLocale(@NotNull CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
|
|
|
@ -25,4 +25,4 @@ messages:
|
|||
off: 'off'
|
||||
container:
|
||||
player: '%player%''s Inventory'
|
||||
enderchest: '%Player''s Ender Chest'
|
||||
enderchest: '%player%''s Ender Chest'
|
||||
|
|
Loading…
Reference in a new issue