Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
MythicCraft
MythicCosmetics
Commits
f96d03d1
Commit
f96d03d1
authored
3 months ago
by
Ash
Browse files
Options
Download
Email Patches
Plain Diff
Better language support
parent
27212904
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
1 deletion
+50
-1
plugin/src/main/java/io/lumine/cosmetics/config/Configuration.java
...c/main/java/io/lumine/cosmetics/config/Configuration.java
+3
-1
plugin/src/main/java/io/lumine/cosmetics/config/MCCLang.java
plugin/src/main/java/io/lumine/cosmetics/config/MCCLang.java
+47
-0
No files found.
plugin/src/main/java/io/lumine/cosmetics/config/Configuration.java
View file @
f96d03d1
...
...
@@ -12,7 +12,6 @@ import io.lumine.mythic.bukkit.utils.config.properties.Property;
import
io.lumine.mythic.bukkit.utils.config.properties.PropertyHolder
;
import
io.lumine.mythic.bukkit.utils.logging.Log
;
import
io.lumine.mythic.bukkit.utils.plugin.ReloadableModule
;
import
io.lumine.mythic.core.packs.PackImpl
;
import
lombok.Getter
;
import
java.io.File
;
...
...
@@ -33,6 +32,7 @@ public class Configuration extends ReloadableModule<MCCosmeticsPlugin> implement
private
static
final
BooleanProp
CRUCIBLE_GENERATION
=
Property
.
Boolean
(
Scope
.
CONFIG
,
"Assets.CrucibleGeneration"
,
false
);
//private static final StringProp ASSET_PACK = Property.String(Scope.CONFIG, "Assets.PackToGenerateFrom", "MythicCosmetics");
@Getter
private
MCCLang
languageManager
;
@Getter
private
boolean
allowingMetrics
=
true
;
@Getter
private
final
Pack
mythicPack
;
...
...
@@ -40,6 +40,8 @@ public class Configuration extends ReloadableModule<MCCosmeticsPlugin> implement
public
Configuration
(
MCCosmeticsPlugin
plugin
)
{
super
(
plugin
);
this
.
languageManager
=
new
MCCLang
(
plugin
);
this
.
languageManager
.
setLanguage
(
"en-us"
);
this
.
mythicPack
=
MythicBukkit
.
inst
().
getPackManager
().
getCosmeticsPack
();
}
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/config/MCCLang.java
0 → 100644
View file @
f96d03d1
package
io.lumine.cosmetics.config
;
import
io.lumine.cosmetics.MCCosmeticsPlugin
;
import
io.lumine.mythic.bukkit.MythicBukkit
;
import
io.lumine.mythic.bukkit.commands.CommandHelper
;
import
io.lumine.mythic.bukkit.utils.locale.Language
;
import
org.bukkit.command.CommandSender
;
public
class
MCCLang
extends
Language
{
private
static
MCCLang
instance
;
private
static
MCCLang
inst
()
{
return
instance
;
}
public
static
String
get
(
String
key
,
String
defaultValue
,
Object
...
args
)
{
return
instance
.
getString
(
key
,
defaultValue
,
args
);
}
public
static
void
send
(
CommandSender
sender
,
String
key
,
String
defaultValue
,
Object
...
args
)
{
final
var
message
=
get
(
key
,
defaultValue
,
args
);
if
(
message
!=
null
&&
!
message
.
isEmpty
())
{
CommandHelper
.
send
(
sender
,
message
);
}
}
public
static
void
sendSuccess
(
CommandSender
sender
,
String
key
,
String
defaultValue
,
Object
...
args
)
{
final
var
message
=
get
(
key
,
defaultValue
,
args
);
if
(
message
!=
null
&&
!
message
.
isEmpty
())
{
CommandHelper
.
sendSuccess
(
sender
,
get
(
key
,
defaultValue
,
args
));
}
}
public
static
void
sendError
(
CommandSender
sender
,
String
key
,
String
defaultValue
,
Object
...
args
)
{
final
var
message
=
get
(
key
,
defaultValue
,
args
);
if
(
message
!=
null
&&
!
message
.
isEmpty
())
{
CommandHelper
.
sendError
(
sender
,
get
(
key
,
defaultValue
,
args
));
}
}
public
MCCLang
(
MCCosmeticsPlugin
plugin
)
{
super
(
MythicBukkit
.
inst
(),
"config/lang"
,
"mythiccosmetics"
);
instance
=
this
;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment