mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 14:38:53 +00:00
Further tweaks to map hook refactoring
This commit is contained in:
1 parent
98fa779046
commit
4e798a42e8
13 files changed
+50
-24
No files matched your search
@@ -36,8 +36,8 @@ public class BlueMapHook extends MapHook {
|
||||
|
||||
for (World world : plugin.getWorlds()) {
|
||||
getMapWorld(world).ifPresent(mapWorld -> {
|
||||
final MarkerSet publicHomeMarkers = MarkerSet.builder().label("Public Homes").build();
|
||||
final MarkerSet warpsMarkers = MarkerSet.builder().label("Warps").build();
|
||||
final MarkerSet publicHomeMarkers = MarkerSet.builder().label(getPublicHomesMarkerSetName()).build();
|
||||
final MarkerSet warpsMarkers = MarkerSet.builder().label(getWarpsMarkerSetName()).build();
|
||||
|
||||
for (BlueMapMap map : mapWorld.getMaps()) {
|
||||
map.getMarkerSets().put(plugin.getKey(map.getId()).toString(), publicHomeMarkers);
|
||||
|
||||
@@ -39,23 +39,19 @@ public class DynmapHook extends MapHook {
|
||||
@Override
|
||||
public void apiEnabled(@NotNull DynmapCommonAPI dynmapCommonAPI) {
|
||||
dynmapApi = dynmapCommonAPI;
|
||||
populateMap();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateMap() {
|
||||
getDynmap().ifPresent(api -> {
|
||||
if (plugin.getSettings().isPublicHomesOnMap()) {
|
||||
getMarkerIcon(PUBLIC_HOME_MARKER_IMAGE_NAME).orElseThrow();
|
||||
api.getMarkerAPI().createMarkerSet(getPublicHomesKey(),
|
||||
"Public Homes", api.getMarkerAPI().getMarkerIcons(), false);
|
||||
}
|
||||
if (plugin.getSettings().isWarpsOnMap()) {
|
||||
getMarkerIcon(WARP_MARKER_IMAGE_NAME).orElseThrow();
|
||||
api.getMarkerAPI().createMarkerSet(getPublicHomesKey(),
|
||||
"Public Homes", api.getMarkerAPI().getMarkerIcons(), false);
|
||||
if (plugin.getSettings().isPublicHomesOnMap()) {
|
||||
getMarkerIcon(PUBLIC_HOME_MARKER_IMAGE_NAME).orElseThrow();
|
||||
dynmapApi.getMarkerAPI().createMarkerSet(getPublicHomesKey(),
|
||||
getPublicHomesMarkerSetName(), dynmapApi.getMarkerAPI().getMarkerIcons(), false);
|
||||
}
|
||||
if (plugin.getSettings().isWarpsOnMap()) {
|
||||
getMarkerIcon(WARP_MARKER_IMAGE_NAME).orElseThrow();
|
||||
dynmapApi.getMarkerAPI().createMarkerSet(getWarpsKey(),
|
||||
getWarpsMarkerSetName(), dynmapApi.getMarkerAPI().getMarkerIcons(), false);
|
||||
}
|
||||
|
||||
populateMap();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -150,10 +146,10 @@ public class DynmapHook extends MapHook {
|
||||
return getDynmap().map(api -> {
|
||||
warpsMarkers = api.getMarkerAPI().getMarkerSet(getWarpsKey());
|
||||
if (warpsMarkers == null) {
|
||||
warpsMarkers = api.getMarkerAPI().createMarkerSet(getWarpsKey(), "Warps",
|
||||
warpsMarkers = api.getMarkerAPI().createMarkerSet(getWarpsKey(), getWarpsMarkerSetName(),
|
||||
api.getMarkerAPI().getMarkerIcons(), false);
|
||||
} else {
|
||||
warpsMarkers.setMarkerSetLabel("Warps");
|
||||
warpsMarkers.setMarkerSetLabel(getWarpsMarkerSetName());
|
||||
}
|
||||
return warpsMarkers;
|
||||
});
|
||||
@@ -163,10 +159,10 @@ public class DynmapHook extends MapHook {
|
||||
return getDynmap().map(api -> {
|
||||
publicHomesMarkers = api.getMarkerAPI().getMarkerSet(getPublicHomesKey());
|
||||
if (publicHomesMarkers == null) {
|
||||
publicHomesMarkers = api.getMarkerAPI().createMarkerSet(getPublicHomesKey(), "Public Homes",
|
||||
publicHomesMarkers = api.getMarkerAPI().createMarkerSet(getPublicHomesKey(), getPublicHomesMarkerSetName(),
|
||||
api.getMarkerAPI().getMarkerIcons(), false);
|
||||
} else {
|
||||
publicHomesMarkers.setMarkerSetLabel("Public Homes");
|
||||
publicHomesMarkers.setMarkerSetLabel(getPublicHomesMarkerSetName());
|
||||
}
|
||||
return publicHomesMarkers;
|
||||
});
|
||||
|
||||
@@ -7,8 +7,6 @@ import net.william278.huskhomes.position.Warp;
|
||||
import net.william278.huskhomes.user.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* A hook for a mapping plugin, such as Dynmap
|
||||
*/
|
||||
@@ -105,6 +103,18 @@ public abstract class MapHook extends Hook {
|
||||
return plugin.getKey(getName().toLowerCase(), "warps", "markers").toString();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected final String getPublicHomesMarkerSetName() {
|
||||
return plugin.getLocales().getRawLocale("map_hook_public_homes_marker_set_name")
|
||||
.orElse("Public Homes");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected final String getWarpsMarkerSetName() {
|
||||
return plugin.getLocales().getRawLocale("map_hook_warps_marker_set_name")
|
||||
.orElse("Warps");
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies types of supported Map plugins
|
||||
*/
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ Spent %1% to make your home public.](gray
|
||||
economy_action_random_teleport: '[ℹ Spent %1% to randomly teleport.](gray)'
|
||||
economy_action_back_command: '[ℹ Spent %1% to return to your last position.](gray)'
|
||||
return_by_death_notification: '[Return to where you died?](gray) [[⏪ Teleport…]](#00fb9a show_text=�fb9a&Click to teleport\n&7Return to where you died run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[Error:](#ff3300) [You already have a home set with that name.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ %1% für das Setzen deines Homes auf öff
|
||||
economy_action_random_teleport: '[ℹ %1% ausgegeben, um zufällig teleportiert zu werden.](gray)'
|
||||
economy_action_back_command: '[ℹ %1% ausgegeben, um zu deiner letzten Position zurückzukehren.](gray)'
|
||||
return_by_death_notification: '[Dorthin zurückkehren, wo du gestorben bist?](gray) [[⏪ Teleportieren…]](#00fb9a show_text=�fb9a&Klicke, um dich zu teleportieren\n&7Kehre dorthin zurück, wo du gestorben bist run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[Fehler:](#ff3300) [Du hast bereits ein Home mit diesem Namen gesetzt.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ Spent %1% to make your home public.](gray
|
||||
economy_action_random_teleport: '[ℹ Spent %1% to randomly teleport.](gray)'
|
||||
economy_action_back_command: '[ℹ Spent %1% to return to your last position.](gray)'
|
||||
return_by_death_notification: '[Return to where you died?](gray) [[⏪ Teleport…]](#00fb9a show_text=�fb9a&Click to teleport\n&7Return to where you died run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[Error:](#ff3300) [You already have a home set with that name.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ Paga %1% Para hacer tu casa pública.](gr
|
||||
economy_action_random_teleport: '[ℹ Paga %1% para teletransportarse aleatoriamente.](gray)'
|
||||
economy_action_back_command: '[ℹ Paga %1% para volver a su última posición.](gray)'
|
||||
return_by_death_notification: '[¿Regresar al lugar donde murió?](gray) [[⏪ Teletransportar…]](#00fb9a show_text=�fb9a&Clic para teletransportarte\n&7Regresa al lugar donde moriste run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[Error:](#ff3300) [Ya tienes una casa con ese nombre.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ Hai pagato %1% per impostare la tua home
|
||||
economy_action_random_teleport: '[ℹ Hai pagato %1% per teletrasportarti randomicamente.](gray)'
|
||||
economy_action_back_command: '[ℹ Hai pagato %1% per tornare alla posizione precedente.](gray)'
|
||||
return_by_death_notification: '[Vuoi ritornare dove sei morto?](gray) [[⏪ Teletrasportati…]](#00fb9a show_text=�fb9a&Clicca per teletrasportarti\n&7e tornare dove sei morto run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[Errore:](#ff3300) [Hai già una home impostata con quel nome.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ Spent %1% to make your home public.](gray
|
||||
economy_action_random_teleport: '[ℹ Spent %1% to randomly teleport.](gray)'
|
||||
economy_action_back_command: '[ℹ Spent %1% to return to your last position.](gray)'
|
||||
return_by_death_notification: '[Return to where you died?](gray) [[⏪ Teleport…]](#00fb9a show_text=�fb9a&Click to teleport\n&7Return to where you died run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[Error:](#ff3300) [You already have a home set with that name.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ Evinizi herkese açık hale getirmek içi
|
||||
economy_action_random_teleport: '[ℹ Rastgele ışınlanmak için %1% harcadınız.](gray)'
|
||||
economy_action_back_command: '[ℹ Son konumunuza dönmek için %1% harcadınız.](gray)'
|
||||
return_by_death_notification: '[Öldüğün yere dön?](gray) [[⏪ Işınlanma…]](#00fb9a show_text=�fb9a&Işınlanmak için tıklayın\n&7Öldüğün yere dön run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[Hata:](#ff3300) [Bu ada sahip bir eviniz zaten var.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ Spent %1% to make your home public.](gray
|
||||
economy_action_random_teleport: '[ℹ Spent %1% to randomly teleport.](gray)'
|
||||
economy_action_back_command: '[ℹ Spent %1% to return to your last position.](gray)'
|
||||
return_by_death_notification: '[Return to where you died?](gray) [[⏪ Teleport…]](#00fb9a show_text=�fb9a&Click to teleport\n&7Return to where you died run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[Error:](#ff3300) [You already have a home set with that name.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ 花费 %1% 将家设为公开.](gray)'
|
||||
economy_action_random_teleport: '[ℹ 花费 %1% 使用随机传送.](gray)'
|
||||
economy_action_back_command: '[ℹ 花费 %1% 回到上一位置.](gray)'
|
||||
return_by_death_notification: '[回到上一个位置?](gray) [[⏪ 点击传送…]](#00fb9a show_text=�fb9a&点击传送\n&7返回上一位置 run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[错误:](#ff3300) [已有一个相同名称的家.](#ff7e5e)'
|
||||
|
||||
@@ -94,6 +94,8 @@ economy_action_make_home_public: '[ℹ 花費 %1% 將家設為公開.](gray)'
|
||||
economy_action_random_teleport: '[ℹ 花費 %1% 使用隨機傳送.](gray)'
|
||||
economy_action_back_command: '[ℹ 花費 %1% 回到上一位置.](gray)'
|
||||
return_by_death_notification: '[回到上一個位置?](gray) [[⏪ 傳送…]](#00fb9a show_text=�fb9a&點擊傳送\n&7返回上一位置 run_command=/huskhomes:back)'
|
||||
map_hook_public_homes_marker_set_name: 'Public Homes'
|
||||
map_hook_warps_marker_set_name: 'Warps'
|
||||
up_to_date: '[HuskHomes](#00fb9a bold) [| You are running the latest version of HuskHomes (v%1%).](#00fb9a)'
|
||||
update_available: '[HuskHomes](#ff7e5e bold) [| A new version of HuskHomes is available: v%1% (running: v%2%).](#ff7e5e)'
|
||||
error_home_name_taken: '[錯誤:](#ff3300) [已有一個相同名稱的家.](#ff7e5e)'
|
||||
|
||||
Reference in new issue
Block a user