Skip to content

Commit

Permalink
Katyara22 add button remove all waypoints (#25)
Browse files Browse the repository at this point in the history
* add remove all waypoints button

* update localization
  • Loading branch information
Katyara22 authored Jul 9, 2024
1 parent 0cad76a commit 48f429c
Show file tree
Hide file tree
Showing 18 changed files with 126 additions and 35 deletions.
127 changes: 92 additions & 35 deletions src/main/java/journeymap/client/ui/waypoint/WaypointManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ public class WaypointManager extends JmUI
Boolean canUserTeleport;
private SortButton buttonSortName, buttonSortDistance;
private DimensionsButton buttonDimensions;
private Button buttonClose, buttonAdd, buttonOptions;
private Button buttonClose, buttonAdd, buttonOptions, buttonRemoveAllWaypoints, buttonConfirmClose, buttonConfirm;
private OnOffButton buttonToggleAll;
private ButtonList bottomButtons;
private ButtonList bottomButtonsMainList;
private ButtonList bottomButtonsConfirmList;
private Waypoint focusWaypoint;
private ArrayList<WaypointManagerItem> items = new ArrayList<WaypointManagerItem>();

Expand All @@ -74,6 +76,68 @@ public WaypointManager(Waypoint focusWaypoint, JmUI returnDisplay)

@Override
public void initGui()
{
initBasicGui(() -> {
// Bottom buttons
if (buttonDimensions == null)
{
buttonDimensions = new DimensionsButton();
}

if (buttonAdd == null)
{
buttonAdd = new Button(Constants.getString("jm.waypoint.new"));
buttonAdd.fitWidth(getFontRenderer());
buttonAdd.setWidth(buttonAdd.getWidth() * 2);
// String tooltip = Constants.getString("jm.waypoint.new.tooltip");
// buttonAdd.setTooltip(tooltip);
}

if (buttonOptions == null)
{
buttonOptions = new Button(Constants.getString("jm.common.options_button"));
buttonOptions.fitWidth(getFontRenderer());
// String tooltip = Constants.getString("jm.waypoint.help.tooltip");
// buttonOptions.setTooltip(tooltip);
}

if (buttonRemoveAllWaypoints == null)
{
buttonRemoveAllWaypoints = new Button(Constants.getString("jm.common.remove_all"));
buttonRemoveAllWaypoints.fitWidth(getFontRenderer());
}

buttonClose = new Button(Constants.getString("jm.common.close"));

bottomButtonsMainList = new ButtonList(buttonOptions, buttonAdd, buttonDimensions, buttonRemoveAllWaypoints, buttonClose);
bottomButtons = bottomButtonsMainList;
buttonList.addAll(bottomButtons);
});
}

private void initConfirmGui()
{
initBasicGui(() -> {
// Bottom buttons
if (buttonConfirmClose == null)
{
buttonConfirmClose = new Button(Constants.getString("jm.common.close"));
buttonConfirmClose.fitWidth(getFontRenderer());
}

if (buttonConfirm == null)
{
buttonConfirm = new Button(Constants.getString("jm.common.confirm"));
buttonConfirm.fitWidth(getFontRenderer());
}

bottomButtonsConfirmList = new ButtonList(buttonConfirm, buttonConfirmClose);
bottomButtons = bottomButtonsConfirmList;
buttonList.addAll(bottomButtons);
});
}

private void initBasicGui(Runnable init)
{
try
{
Expand Down Expand Up @@ -114,34 +178,7 @@ public void initGui()
}
buttonList.add(buttonToggleAll);

// Bottom buttons
if (buttonDimensions == null)
{
buttonDimensions = new DimensionsButton();
}

if (buttonAdd == null)
{
buttonAdd = new Button(Constants.getString("jm.waypoint.new"));
buttonAdd.fitWidth(getFontRenderer());
buttonAdd.setWidth(buttonAdd.getWidth() * 2);
// String tooltip = Constants.getString("jm.waypoint.new.tooltip");
// buttonAdd.setTooltip(tooltip);
}

if (buttonOptions == null)
{
buttonOptions = new Button(Constants.getString("jm.common.options_button"));
buttonOptions.fitWidth(getFontRenderer());
// String tooltip = Constants.getString("jm.waypoint.help.tooltip");
// buttonOptions.setTooltip(tooltip);
}

buttonClose = new Button(Constants.getString("jm.common.close"));

bottomButtons = new ButtonList(buttonOptions, buttonAdd, buttonDimensions, buttonClose);
buttonList.addAll(bottomButtons);

init.run();

if (this.items.isEmpty())
{
Expand All @@ -166,10 +203,6 @@ public void initGui()
}
}
}
else
{

}

if (itemScrollPane == null)
{
Expand All @@ -187,7 +220,6 @@ public void initGui()
{
itemScrollPane.scrollTo(items.get(0));
}

}
catch (Throwable t)
{
Expand Down Expand Up @@ -348,7 +380,6 @@ protected void checkPressedButton()
if (slotMetadata != null) // TODO
{


}

ScrollListPane.ISlot parentSlot = (CategorySlot) itemScrollPane.getLastPressedParentSlot();
Expand Down Expand Up @@ -402,6 +433,32 @@ protected void actionPerformed(GuiButton guibutton)
UIManager.getInstance().openOptionsManager(this, Config.Category.Waypoint, Config.Category.WaypointBeacon);
return;
}
if (guibutton == buttonRemoveAllWaypoints)
{
initConfirmGui();

return;
}

// confirm buttons
if (guibutton == buttonConfirmClose)
{
UIManager.getInstance().openWaypointManager(null, this);

return;
}
if (guibutton == buttonConfirm)
{
WaypointStore.instance().getAll().forEach(x -> {
WaypointStore.instance().remove(x);
});

this.items = new ArrayList<WaypointManagerItem>();

initGui();

return;
}
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/ar_SA.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ jm.common.automap_text=تلقائيا خريطة المناطق (لاعب واح
jm.common.automap_title=تلقائي للخرائط ...
jm.common.chat_announcement=§eJourneyMap : §f %1$s
jm.common.close=إغلاق
jm.common.confirm=تأكيد
jm.common.day=يوم
# jm.common.deletemap_dialog=Delete Map
# jm.common.deletemap_dialog_all=All Dimensions
jm.common.remove_all=إزالة جميع النقاط
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
# jm.common.deletemap_status_done=Map deleted.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/ca_ES.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ jm.common.automap_text=Assignar automàticament regions del mapa (un únic jugad
jm.common.automap_title=Mapa automàtic...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Tancar
jm.common.confirm=Confirma
jm.common.day=Dia
# jm.common.deletemap_dialog=Delete Map
# jm.common.deletemap_dialog_all=All Dimensions
jm.common.remove_all=Elimina tots els punts de referència
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
# jm.common.deletemap_status_done=Map deleted.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/de_DE.lang
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ jm.common.automap_text=Automatisch Regionen aufzeichnen (Einzelspieler)
jm.common.automap_title=Auto-Mapping...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Schließen
jm.common.confirm=Bestätigen
jm.common.day=Tag
jm.common.deletemap_dialog=Karte löschen
jm.common.deletemap_dialog_all=Alle Dimensionen
jm.common.remove_all=Entferne alle Wegpunkte
jm.common.deletemap_dialog_text=Die Karte von allen Dimensionen oder nur von dieser Dimension löschen?
jm.common.deletemap_dialog_this=Diese Dimension
jm.common.deletemap_status_done=Karte gelöscht.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jm.common.automap_text=Automatically map regions (single-player)
jm.common.automap_title=Auto-Map...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Close
jm.common.confirm=Confirm
jm.common.remove_all=Remove all waypoints
jm.common.day=Day
jm.common.deletemap_dialog=Delete Map
jm.common.deletemap_dialog_all=All Dimensions
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/es_ES.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jm.common.automap_text=Asignar automaticamente regiones del mapa (un solo jugado
jm.common.automap_title=Mapa automatico...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Cerrar
jm.common.confirm=Confirmar
jm.common.day=Dia
# jm.common.deletemap_dialog=Delete Map
jm.common.remove_all=Eliminar todos los puntos de referencia
# jm.common.deletemap_dialog_all=All Dimensions
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/fi_FI.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jm.common.automap_text=Kartoita alueet automaattisesti (single-player)
jm.common.automap_title=Automaattinen kartoitus...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Sulje
jm.common.confirm=Vahvista
jm.common.day=Päivä
jm.common.deletemap_dialog=Poista kartta...
jm.common.remove_all=Poista kaikki reittipisteet
jm.common.deletemap_dialog_all=Kaikki ulottuvuudet
jm.common.deletemap_dialog_text=Poista kartta kaikista ulottuvuuksista vai vain nykyisestä.
jm.common.deletemap_dialog_this=Tämä ulottuvuus
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/fr_CA.lang
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ jm.common.automap_text=Cartographier automatiquement les régions (Solo)
jm.common.automap_title=Cartographie automatique...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Fermer
jm.common.confirm=Confirmer
jm.common.day=Jour
jm.common.deletemap_dialog=Effacer Carte
jm.common.deletemap_dialog_all=Toutes les Dimensions
jm.common.deletemap_dialog_text=Effacer Carte dans toutes les dimensions ou juste la Dimension actuelle?
jm.common.remove_all=Supprimer tous les points de passage
jm.common.deletemap_dialog_this=Cette Dimension
jm.common.deletemap_status_done=Carte effacée.
jm.common.deletemap_status_error=Impossible d'effacer la Carte. Voir le fichier "journeymap.log" pour plus de détails.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/fr_FR.lang
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ jm.common.automap_text=Cartographier automatiquement les régions (Solo)
jm.common.automap_title=Cartographie automatique...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Fermer
jm.common.confirm=Confirmer
jm.common.day=Jour
jm.common.deletemap_dialog=Effacer Carte
jm.common.deletemap_dialog_all=Toutes les Dimensions
jm.common.remove_all=Supprimer tous les points de passage
jm.common.deletemap_dialog_text=Effacer Carte dans toutes les dimensions ou juste la Dimension actuelle?
jm.common.deletemap_dialog_this=Cette Dimension
jm.common.deletemap_status_done=Carte effacée.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/hu_HU.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jm.common.automap_text=Automatikus térkép területek (Egyzsemélyes játékmó
jm.common.automap_title=Auto-Map...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Bezárás
jm.common.confirm=Megerősít
jm.common.day=Nappal
# jm.common.deletemap_dialog=Delete Map
jm.common.remove_all=Az összes útvonalpont eltávolítása
# jm.common.deletemap_dialog_all=All Dimensions
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/ja_JP.lang
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ jm.common.automap_text=自動でマップを生成(シングルプレイ限定)
jm.common.automap_title=自動マップ生成...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=閉じる
jm.common.confirm=確認
jm.common.day=昼
jm.common.remove_all=すべてのウェイポイントを削除
jm.common.deletemap_dialog=マップを削除
jm.common.deletemap_dialog_all=全てのディメンション
jm.common.deletemap_dialog_text=全てのディメンション、またはこのディメンションだけ削除しますか?
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/ko_KR.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jm.common.automap_text=자동적으로 지형의 지도를 생성합니다 (싱
jm.common.automap_title=오토맵...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=닫기
jm.common.confirm=확인
jm.common.day=낮
# jm.common.deletemap_dialog=Delete Map
jm.common.remove_all=모든 웨이포인트 제거
# jm.common.deletemap_dialog_all=All Dimensions
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/nl_NL.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jm.common.automap_text=Breng automatisch regio's in kaart (single-player)
jm.common.automap_title=Auto-Map...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Sluit
jm.common.confirm=Bevestigen
jm.common.day=Dag
# jm.common.deletemap_dialog=Delete Map
jm.common.remove_all=Verwijder alle waypoints
# jm.common.deletemap_dialog_all=All Dimensions
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/no_NO.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jm.common.automap_text=kartlegger regioner automatisk (single-player)
jm.common.automap_title=Auto-Kartlegging...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Lukk
jm.common.confirm=Bekreft
jm.common.day=Dag
# jm.common.deletemap_dialog=Delete Map
jm.common.remove_all=Fjern alle veipunkter
# jm.common.deletemap_dialog_all=All Dimensions
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/pt_BR.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ jm.common.automap_text=Mapear automaticamente as regiões (single-player)
jm.common.automap_title=Automapeamento...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Fechar
jm.common.confirm=Confirmar
jm.common.day=Dia
jm.common.deletemap_dialog=Apagar o mapa
jm.common.deletemap_dialog_all=Todas as dimensões
jm.common.remove_all=Remover todos os pontos de passagem
jm.common.deletemap_dialog_text=Apagar o mapa em todas as dimensões ou somente nesta dimensão?
jm.common.deletemap_dialog_this=Esta Dimensão
jm.common.deletemap_status_done=Mapa apagado.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/ru_RU.lang
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ jm.common.automap_dialog_none=Ничего
jm.common.automap_dialog_text=Автоматически прорисовать все регионы или только пропущенные?
jm.common.automap_status=Прорисовка поверхности (%1$s).
jm.common.automap_status_underground=Прорисовка слоя %1$s (%2$s).
jm.common.remove_all=Удалить все путевые точки
jm.common.automap_text=Автоматическая прорисовка поверхности (одиночная игра)
jm.common.automap_title=Авто карта…
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=Закрыть
jm.common.confirm=Подтвердить
jm.common.day=День
jm.common.deletemap_dialog=Удалить карту
jm.common.deletemap_dialog_all=Все измерения
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/sv_SE.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ jm.common.automap_text=Automatisk kartläggning av regioner (en spelare)
jm.common.automap_title=Automatisk karta...
jm.common.chat_announcement=§eJourneyMap: §f %1$s
jm.common.close=Stäng
jm.common.confirm=Bekräfta
jm.common.day=Dag
# jm.common.deletemap_dialog=Delete Map
# jm.common.deletemap_dialog_all=All Dimensions
jm.common.remove_all=Ta bort alla vägpunkte
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
# jm.common.deletemap_status_done=Map deleted.
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/journeymap/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ jm.common.automap_text=自动绘制区域地图(单人游戏)
jm.common.automap_title=自动绘制地图...
jm.common.chat_announcement=§eJourneyMap:§f %1$s
jm.common.close=关闭
jm.common.confirm=确认
jm.common.day=白天
# jm.common.deletemap_dialog=Delete Map
# jm.common.deletemap_dialog_all=All Dimensions
jm.common.remove_all=删除所有航点
# jm.common.deletemap_dialog_text=Delete map in all dimensions or just this dimension?
# jm.common.deletemap_dialog_this=This Dimension
# jm.common.deletemap_status_done=Map deleted.
Expand Down

0 comments on commit 48f429c

Please sign in to comment.