mirror of
https://github.com/BentoBoxWorld/Warps.git
synced 2025-02-16 20:31:23 +01:00
Adds the missing support for PLAYER_HEAD icons
https://github.com/BentoBoxWorld/Warps/issues/38
This commit is contained in:
parent
633f2a63e2
commit
c671e35661
@ -29,9 +29,7 @@ public class WarpPanelManager {
|
||||
}
|
||||
|
||||
private PanelItem getPanelItem(World world, UUID warpOwner) {
|
||||
// Return a sign panel item
|
||||
return new PanelItemBuilder()
|
||||
.icon(getSignIcon(world, warpOwner))
|
||||
PanelItemBuilder pib = new PanelItemBuilder()
|
||||
.name(addon.getPlugin().getPlayers().getName(warpOwner))
|
||||
.description(getSign(world, warpOwner))
|
||||
.clickHandler((panel, clicker, click, slot) -> { {
|
||||
@ -39,7 +37,13 @@ public class WarpPanelManager {
|
||||
addon.getWarpSignsManager().warpPlayer(world, clicker, warpOwner);
|
||||
return true;
|
||||
}
|
||||
}).build();
|
||||
});
|
||||
Material icon = getSignIcon(world, warpOwner);
|
||||
if (icon.equals(Material.PLAYER_HEAD)) {
|
||||
return pib.icon(addon.getPlayers().getName(warpOwner)).build();
|
||||
} else {
|
||||
return pib.icon(icon).build();
|
||||
}
|
||||
}
|
||||
|
||||
private Material getSignIcon(World world, UUID warpOwner) {
|
||||
|
@ -262,8 +262,12 @@ public class WarpSignsManager {
|
||||
// Remove any trailing blank lines
|
||||
result.removeIf(String::isEmpty);
|
||||
// Get the sign type
|
||||
Material type = Material.valueOf(sign.getType().name().replace("WALL_", ""));
|
||||
return new SignCache(result, type);
|
||||
Material icon = Material.matchMaterial(addon.getSettings().getIcon());
|
||||
if (icon == null || icon.name().contains("SIGN")) {
|
||||
return new SignCache(result, Material.valueOf(sign.getType().name().replace("WALL_", "")));
|
||||
} else {
|
||||
return new SignCache(result, icon);
|
||||
}
|
||||
} else {
|
||||
addon.getWarpSignsManager().removeWarp(world, uuid);
|
||||
}
|
||||
|
@ -30,9 +30,10 @@ public class Settings implements ConfigObject
|
||||
private String welcomeLine;
|
||||
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Icon that will be displayed in Warps list.")
|
||||
@ConfigComment("It uses native Minecraft material strings, but using string 'PLAYER', it is possible to")
|
||||
@ConfigComment("use player heads instead.")
|
||||
@ConfigComment("Icon that will be displayed in Warps list. SIGN counts for any kind of sign and the type of")
|
||||
@ConfigComment("wood used will be reflected in the panel if the server supports it.")
|
||||
@ConfigComment("It uses native Minecraft material strings, but using string 'PLAYER_HEAD', it is possible to")
|
||||
@ConfigComment("use player heads instead. Beware that Mojang API rate limiting may prevent heads from loading.")
|
||||
@ConfigEntry(path = "icon")
|
||||
private String icon = "SIGN";
|
||||
|
||||
|
@ -12,9 +12,10 @@ warplevelrestriction: 10
|
||||
# Not case sensitive!
|
||||
welcomeLine: '[Welcome]'
|
||||
#
|
||||
# Icon that will be displayed in Warps list.
|
||||
# It uses native Minecraft material strings, but using string 'PLAYER', it is possible to
|
||||
# use player heads instead.
|
||||
# Icon that will be displayed in Warps list. SIGN counts for any kind of sign and the type of
|
||||
# wood used will be reflected in the panel if the server supports it.
|
||||
# It uses native Minecraft material strings, but using string 'PLAYER_HEAD', it is possible to
|
||||
# use player heads instead. Beware that Mojang API rate limiting may prevent heads from loading.
|
||||
icon: 'SIGN'
|
||||
#
|
||||
# This list stores GameModes in which Level addon should not work.
|
||||
@ -22,5 +23,3 @@ icon: 'SIGN'
|
||||
# disabled-gamemodes:
|
||||
# - BSkyBlock
|
||||
disabled-gamemodes: []
|
||||
#
|
||||
uniqueId: config
|
||||
|
Loading…
Reference in New Issue
Block a user