mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +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;
|
String title;
|
||||||
if (inventory instanceof SpecialEnderChest) {
|
if (inventory instanceof SpecialEnderChest) {
|
||||||
HumanEntity owner = (HumanEntity) ((SpecialEnderChest) inventory).getBukkitOwner();
|
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) {
|
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) {
|
} else if (inventory instanceof SpecialPlayerInventory) {
|
||||||
EntityHuman owner = ((PlayerInventory) inventory).player;
|
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) {
|
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 {
|
} else {
|
||||||
return player.openInventory(inventory.getBukkitInventory());
|
return player.openInventory(inventory.getBukkitInventory());
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,17 +192,16 @@ public class PlayerDataManager implements IPlayerDataManager {
|
||||||
String title;
|
String title;
|
||||||
if (inventory instanceof SpecialEnderChest) {
|
if (inventory instanceof SpecialEnderChest) {
|
||||||
HumanEntity owner = (HumanEntity) ((SpecialEnderChest) inventory).getBukkitOwner();
|
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) {
|
if (title == null) {
|
||||||
title = "%player%'s Ender Chest";
|
title = owner.getName() + "'s Ender Chest";
|
||||||
}
|
}
|
||||||
} else if (inventory instanceof SpecialPlayerInventory) {
|
} else if (inventory instanceof SpecialPlayerInventory) {
|
||||||
EntityHuman owner = ((PlayerInventory) inventory).player;
|
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) {
|
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 {
|
} else {
|
||||||
return player.openInventory(inventory.getBukkitInventory());
|
return player.openInventory(inventory.getBukkitInventory());
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,6 +313,10 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
|
||||||
return this.languageManager.getValue(key, getLocale(sender));
|
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
|
@Nullable
|
||||||
private String getLocale(@NotNull CommandSender sender) {
|
private String getLocale(@NotNull CommandSender sender) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
|
|
|
@ -25,4 +25,4 @@ messages:
|
||||||
off: 'off'
|
off: 'off'
|
||||||
container:
|
container:
|
||||||
player: '%player%''s Inventory'
|
player: '%player%''s Inventory'
|
||||||
enderchest: '%Player''s Ender Chest'
|
enderchest: '%player%''s Ender Chest'
|
||||||
|
|
Loading…
Reference in a new issue