Skip to content

Commit

Permalink
Register child localizer
Browse files Browse the repository at this point in the history
  • Loading branch information
rainbowdashlabs committed Aug 15, 2024
1 parent 14f9c3e commit 0740c11
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 70 deletions.
13 changes: 10 additions & 3 deletions core/src/main/java/de/eldoria/gridselector/GridSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
public class GridSelector extends EldoPlugin {

private JacksonConfiguration configuration;
private Localizer iLocalizer;

public GridSelector() {
this.configuration = new JacksonConfiguration(this);
Expand Down Expand Up @@ -77,10 +78,10 @@ public void onPluginEnable() throws Throwable {

var sbr = SchematicBrushReborn.instance();

var iLocalizer = Localizer.builder(this, "en_US")
.setIncludedLocales("en_US")
iLocalizer = Localizer.builder(this, "en_US")
.setIncludedLocales("de_DE")
.setUserLocale(p -> sbr.config().general().language())
.build();
ILocalizer.getPluginLocalizer(SchematicBrushReborn.class).registerChild(iLocalizer);
var messageSender = MessageSender.builder(this)
.prefix("<gold>[GS]")
.localizer(iLocalizer)
Expand Down Expand Up @@ -122,6 +123,12 @@ public void onPluginEnable() throws Throwable {
registerCommand(new Grid(this, selectionListener, configuration, gridSchematics, messageBlocker, worldGuardAdapter));
}

@Override
public void onPostStart() throws Throwable {

ILocalizer.getPluginLocalizer(SchematicBrushReborn.getInstance()).registerChild(iLocalizer);
}

public Configuration configuration() {
return configuration;
}
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/de/eldoria/gridselector/selector/Grid.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public String name() {
return "Grid";
}

@Override
public String localizedName() {
return "component.selector.gridselector.name";
}

@Override
public String descriptor() {
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public class GridProvider extends SelectorProvider {
public GridProvider(SchematicRegistry registry) {
super(Grid.class, "Grid", registry);
super(Grid.class, "Grid","component.provider.selector.gridselector.name","component.provider.selector.gridselector.description", registry);
}

@Override
Expand All @@ -37,11 +37,6 @@ public Selector defaultSetting() {
return new Grid();
}

@Override
public String description() {
return "Use the schematics you have selected with GridSelector previously.";
}

@Override
public String permission() {
return Permissions.USE;
Expand Down
32 changes: 3 additions & 29 deletions core/src/main/resources/messages.properties
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
about=
dialog.accept=
dialog.add=
dialog.deny=
dialog.leftClickChange=
dialog.remove=
dialog.rightClickRemove=
error.invalidArguments=
error.invalidBoolean=
error.invalidCommand=
error.invalidEnumValue=
error.invalidLength=
error.invalidMaterial=
error.invalidNumber=
error.invalidRange=
error.invalidSender=
error.missingArgument=
error.notAsConsole=
error.notAsPlayer=
error.notOnline=
error.onlyConsole=
error.onlyPlayer=
error.permission=
error.tooLarge=
error.tooSmall=
error.unkownPlayer=
error.unkownWorld=
error.notABrush=
error.unkownPreset=
component.provider.selector.gridselector.name=
component.provider.selector.gridselector.description=
component.selector.gridselector.name=
3 changes: 3 additions & 0 deletions core/src/main/resources/messages_de_DE.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
component.provider.selector.gridselector.name=Gitter
component.provider.selector.gridselector.description=Nutze die Schematics die auf dem Gitter ausgewählt wurden.
component.selector.gridselector.name=Gitter
33 changes: 3 additions & 30 deletions core/src/main/resources/messages_en_US.properties
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
about=%PLUGIN_NAME% by %AUTHORS%\nVersion: %VERSION%\nSpigot: %WEBSITE%\nSupport: %DISCORD%
dialog.accept=accept
dialog.add=add
dialog.deny=deny
dialog.leftClickChange=Left click to change
dialog.remove=remove
dialog.rightClickRemove=Right click to remove
error.invalidArguments=Invalid arguments.\nSyntax: %SYNTAX%
error.invalidBoolean=Invalid value, %TRUE% or %FALSE%
error.invalidCommand=Invalid Command
error.invalidEnumValue=Invalid input value. Valid inputs are %VALUES%.
error.invalidLength=This input is too long. Max: %MAX% chars.
error.invalidMaterial=Invalid material.
error.invalidNumber=Invalid number
error.invalidRange=This value is out of range. Min: %MIN% Max: %MAX%
error.invalidSender=This command can not be executed from here.
error.missingArgument=Argument %INDEX% is accessed but not present.
error.notAsConsole=This command can not be executed from console.
error.notAsPlayer=This command can not be executed as player
error.notOnline=Invalid player. This player is not online.
error.onlyConsole=This command can only be used by console.
error.onlyPlayer=This command can only be used by players.
error.permission=You do not have the permissionNode to do this. (%PERMISSION%)
error.tooLarge=The number is too Large. Max: %MAX%
error.tooSmall=The number is too small. Min: %MIN%
error.unkownPlayer=Invalid player. This player has never played on this server.
error.unkownWorld=Invalid player. This player has never played on this server.
error.notABrush=This is not a schematic brush.
error.unkownPreset=Preset %NAME% does not exist.
error.gridInPlot=Grid functions can not be used in plot worlds.
component.provider.selector.gridselector.name=Grid
component.provider.selector.gridselector.description=Use the schematics you have selected with GridSelector previously.
component.selector.gridselector.name=Grid
5 changes: 3 additions & 2 deletions latest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ tasks {
}

register<Copy>("copyToServer") {
val path = project.property("targetDir") ?: "";
val path = rootProject.property("targetDir") ?: "";
if (path.toString().isEmpty()) {
println("targetDir is not set in gradle properties")
return@register
}
println("Copying jar to $path")
from(shadowJar)
destinationDir = File(path.toString())
into(path.toString())
rename{"gridselector.jar"}
}
}

0 comments on commit 0740c11

Please sign in to comment.