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
907ca587
Commit
907ca587
authored
2 years ago
by
Ashijin
Browse files
Options
Download
Email Patches
Plain Diff
Added Namespace, Permission options to all cosmetics
parent
3016885e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
15 deletions
+37
-15
api/src/main/java/io/lumine/cosmetics/api/cosmetics/Cosmetic.java
...main/java/io/lumine/cosmetics/api/cosmetics/Cosmetic.java
+4
-0
plugin/src/main/java/io/lumine/cosmetics/constants/Permissions.java
.../main/java/io/lumine/cosmetics/constants/Permissions.java
+1
-5
plugin/src/main/java/io/lumine/cosmetics/managers/AbstractCosmetic.java
...n/java/io/lumine/cosmetics/managers/AbstractCosmetic.java
+27
-6
plugin/src/main/java/io/lumine/cosmetics/managers/MCCosmeticsManager.java
...java/io/lumine/cosmetics/managers/MCCosmeticsManager.java
+2
-1
plugin/src/main/java/io/lumine/cosmetics/players/ProfileCosmeticData.java
...java/io/lumine/cosmetics/players/ProfileCosmeticData.java
+2
-2
pom.xml
pom.xml
+1
-1
No files found.
api/src/main/java/io/lumine/cosmetics/api/cosmetics/Cosmetic.java
View file @
907ca587
...
...
@@ -34,6 +34,10 @@ public abstract class Cosmetic implements PropertyHolder,MenuData<CosmeticProfil
return
maybeCosmetic
.
isPresent
()
&&
maybeCosmetic
.
get
().
equals
(
this
);
}
public
abstract
String
getId
();
public
abstract
String
getNamespace
();
public
abstract
String
getPermission
();
public
abstract
boolean
hasVariants
();
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/constants/Permissions.java
View file @
907ca587
package
io.lumine.cosmetics.constants
;
import
io.lumine.cosmetics.api.cosmetics.Cosmetic
;
public
class
Permissions
{
public
static
final
String
cosmeticPermission
(
Cosmetic
cosmetic
)
{
return
"mccosmetics.cosmetic."
+
cosmetic
.
getKey
().
toLowerCase
();
}
public
static
final
String
COSMETIC_PERMISSION_PREFIX
=
"mccosmetics.cosmetic."
;
public
static
final
String
COMMAND_BASE
=
"mccosmetics.command.base"
;
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/managers/AbstractCosmetic.java
View file @
907ca587
...
...
@@ -28,6 +28,8 @@ import java.util.Optional;
public
abstract
class
AbstractCosmetic
extends
Cosmetic
{
protected
static
final
StringProp
NAMESPACE
=
Property
.
String
(
Scope
.
NONE
,
"Namespace"
,
null
);
protected
static
final
StringProp
PERMISSION
=
Property
.
String
(
Scope
.
NONE
,
"Permission"
,
null
);
protected
static
final
EnumProp
<
Material
>
MATERIAL
=
Property
.
Enum
(
Scope
.
NONE
,
Material
.
class
,
"Material"
,
Material
.
EMERALD
);
protected
static
final
IntProp
MODEL
=
Property
.
Int
(
Scope
.
NONE
,
"Model"
);
protected
static
final
LangProp
DISPLAY
=
Property
.
Lang
(
Scope
.
NONE
,
"Display"
);
...
...
@@ -40,7 +42,10 @@ public abstract class AbstractCosmetic extends Cosmetic {
protected
static
final
NodeListProp
VARIANTS
=
Property
.
NodeList
(
Scope
.
NONE
,
"Variants"
);
protected
final
File
file
;
protected
final
String
key
;
@Getter
protected
final
String
id
;
@Getter
protected
final
String
key
;
@Getter
protected
final
String
namespace
;
@Getter
protected
final
String
permission
;
@Getter
protected
final
List
<
String
>
sources
=
Lists
.
newArrayList
();
// Menu Item
...
...
@@ -60,6 +65,26 @@ public abstract class AbstractCosmetic extends Cosmetic {
this
.
file
=
file
;
this
.
key
=
key
;
this
.
namespace
=
NAMESPACE
.
fget
(
file
,
this
);
if
(
namespace
==
null
)
{
this
.
id
=
key
;
}
else
{
this
.
id
=
namespace
+
"."
+
key
;
}
String
perm
=
PERMISSION
.
fget
(
file
,
this
);
if
(
perm
==
null
)
{
if
(
namespace
==
null
)
{
this
.
permission
=
Permissions
.
COSMETIC_PERMISSION_PREFIX
+
key
.
toLowerCase
();
}
else
{
this
.
permission
=
Permissions
.
COSMETIC_PERMISSION_PREFIX
+
namespace
.
toLowerCase
()
+
"."
+
key
.
toLowerCase
();
}
}
else
{
this
.
permission
=
perm
;
}
this
.
material
=
MATERIAL
.
fget
(
file
,
this
);
this
.
model
=
MODEL
.
fget
(
file
,
this
);
this
.
display
=
DISPLAY
.
fget
(
file
,
this
);
...
...
@@ -115,11 +140,7 @@ public abstract class AbstractCosmetic extends Cosmetic {
}
}).
build
();
}
public
String
getPermission
()
{
return
Permissions
.
cosmeticPermission
(
this
);
}
public
boolean
hasVariants
()
{
return
variants
.
isEmpty
()
==
false
;
}
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/managers/MCCosmeticsManager.java
View file @
907ca587
...
...
@@ -54,7 +54,8 @@ public abstract class MCCosmeticsManager<T extends Cosmetic> extends ReloadableM
for
(
var
file
:
files
)
{
for
(
var
node
:
KEYS
.
fget
(
file
))
{
cosmetics
.
put
(
node
,
build
(
file
,
node
));
var
cosmetic
=
build
(
file
,
node
);
cosmetics
.
put
(
cosmetic
.
getId
(),
cosmetic
);
}
}
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/players/ProfileCosmeticData.java
View file @
907ca587
...
...
@@ -17,13 +17,13 @@ public class ProfileCosmeticData {
public
ProfileCosmeticData
(
Cosmetic
cosmetic
)
{
this
.
type
=
cosmetic
.
getType
();
this
.
id
=
cosmetic
.
get
Key
();
this
.
id
=
cosmetic
.
get
Id
();
this
.
variant
=
"default"
;
}
public
ProfileCosmeticData
(
CosmeticVariant
variant
)
{
this
.
type
=
variant
.
getCosmetic
().
getType
();
this
.
id
=
variant
.
getCosmetic
().
get
Key
();
this
.
id
=
variant
.
getCosmetic
().
get
Id
();
this
.
variant
=
variant
.
getKey
();
}
...
...
This diff is collapsed.
Click to expand it.
pom.xml
View file @
907ca587
...
...
@@ -12,7 +12,7 @@
<url>
https://www.lumine.io
</url>
</organization>
<properties>
<properties>
<mccosmetics.version>
0.4.0-SNAPSHOT
</mccosmetics.version>
<paperapi.version>
1.18.2-R0.1-SNAPSHOT
</paperapi.version>
<lumineutils.version>
1.18-SNAPSHOT
</lumineutils.version>
...
...
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