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
503691ab
Commit
503691ab
authored
3 years ago
by
Ticxo
Browse files
Options
Download
Email Patches
Plain Diff
asaasdasd
parent
c1e8264a
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
32 additions
and
50 deletions
+32
-50
.gitignore
.gitignore
+4
-1
api/src/main/java/io/lumine/cosmetics/api/cosmetics/Cosmetic.java
...main/java/io/lumine/cosmetics/api/cosmetics/Cosmetic.java
+3
-6
api/src/main/java/io/lumine/cosmetics/api/players/CosmeticInventory.java
...va/io/lumine/cosmetics/api/players/CosmeticInventory.java
+1
-5
dist/pom.xml
dist/pom.xml
+1
-1
plugin/src/main/java/io/lumine/cosmetics/MCCosmeticsPlugin.java
.../src/main/java/io/lumine/cosmetics/MCCosmeticsPlugin.java
+1
-0
plugin/src/main/java/io/lumine/cosmetics/constants/CosmeticType.java
...main/java/io/lumine/cosmetics/constants/CosmeticType.java
+1
-1
plugin/src/main/java/io/lumine/cosmetics/managers/back/BackManager.java
...n/java/io/lumine/cosmetics/managers/back/BackManager.java
+1
-1
plugin/src/main/java/io/lumine/cosmetics/managers/particle/ParticleManager.java
...o/lumine/cosmetics/managers/particle/ParticleManager.java
+2
-2
plugin/src/main/java/io/lumine/cosmetics/players/ProfileInventory.java
...in/java/io/lumine/cosmetics/players/ProfileInventory.java
+7
-25
v1_18/src/main/java/io/lumine/cosmetics/nms/v1_18_R1/cosmetic/VolatileHatImpl.java
...mine/cosmetics/nms/v1_18_R1/cosmetic/VolatileHatImpl.java
+1
-1
v1_18_R2/pom.xml
v1_18_R2/pom.xml
+1
-1
v1_18_R2/src/main/java/io/lumine/cosmetics/nms/v1_18_R2/cosmetic/VolatileBackImpl.java
...ine/cosmetics/nms/v1_18_R2/cosmetic/VolatileBackImpl.java
+2
-1
v1_18_R2/src/main/java/io/lumine/cosmetics/nms/v1_18_R2/cosmetic/VolatileHatImpl.java
...mine/cosmetics/nms/v1_18_R2/cosmetic/VolatileHatImpl.java
+4
-3
v1_18_R2/src/main/java/io/lumine/cosmetics/nms/v1_18_R2/network/VolatileChannelHandler.java
...osmetics/nms/v1_18_R2/network/VolatileChannelHandler.java
+3
-2
No files found.
.gitignore
View file @
503691ab
...
...
@@ -234,4 +234,7 @@ gradle-app.setting
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
# End of https://www.gitignore.io/api/java,code-java,intellij,eclipse,netbeans,gradle,git,maven,windows,linux,macos
\ No newline at end of file
# End of https://www.gitignore.io/api/java,code-java,intellij,eclipse,netbeans,gradle,git,maven,windows,linux,macos
# Custom defined
/server
This diff is collapsed.
Click to expand it.
api/src/main/java/io/lumine/cosmetics/api/cosmetics/Cosmetic.java
View file @
503691ab
...
...
@@ -39,12 +39,9 @@ public abstract class Cosmetic implements PropertyHolder,MenuData<CosmeticProfil
}
public
boolean
isEquipped
(
CosmeticInventory
inventory
)
{
var
maybeCosmetic
=
inventory
.
getCustomEquipped
(
type
);
if
(
maybeCosmetic
.
isEmpty
())
{
return
false
;
}
return
maybeCosmetic
.
get
().
equals
(
this
);
var
maybeCosmetic
=
inventory
.
getEquipped
(
getClass
());
return
maybeCosmetic
.
isPresent
()
&&
maybeCosmetic
.
get
().
equals
(
this
);
}
}
This diff is collapsed.
Click to expand it.
api/src/main/java/io/lumine/cosmetics/api/players/CosmeticInventory.java
View file @
503691ab
...
...
@@ -10,12 +10,8 @@ public interface CosmeticInventory {
void
initialize
(
CosmeticProfile
profile
);
Collection
<
String
>
getUnlocked
(
String
type
);
Optional
<
Cosmetic
>
getCustomEquipped
(
String
type
);
Optional
<
Cosmetic
>
getEquippedHat
();
Optional
<
Cosmetic
>
getEquipped
Back
(
);
Optional
<
Cosmetic
>
getEquipped
(
Class
<?
extends
Cosmetic
>
tClass
);
void
equip
(
Cosmetic
cosmetic
);
}
This diff is collapsed.
Click to expand it.
dist/pom.xml
View file @
503691ab
...
...
@@ -78,7 +78,7 @@
<version>
3.1.0
</version>
<configuration>
<finalName>
MCCosmetics-${project.parent.version}
</finalName>
<outputDirectory>
../
target
</outputDirectory>
<outputDirectory>
../
server/plugins
</outputDirectory>
</configuration>
</plugin>
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/MCCosmeticsPlugin.java
View file @
503691ab
...
...
@@ -82,6 +82,7 @@ public class MCCosmeticsPlugin extends LuminePlugin {
cosmetics
=
new
CosmeticsExecutor
(
this
);
hatManager
=
new
HatManager
(
this
);
backManager
=
new
BackManager
(
this
);
profiles
=
new
ProfileManager
(
this
);
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/constants/CosmeticType.java
View file @
503691ab
...
...
@@ -15,7 +15,7 @@ public class CosmeticType {
private
static
final
Map
<
Class
<?
extends
Cosmetic
>,
CosmeticConstant
>
constants
=
new
HashMap
<>();
static
{
register
(
BackAccessory
.
class
,
new
CosmeticConstant
(
"BACK"
,
"backs"
));
register
(
BackAccessory
.
class
,
new
CosmeticConstant
(
"BACK
_ACCESSORY
"
,
"backs"
));
register
(
Hat
.
class
,
new
CosmeticConstant
(
"HAT"
,
"hats"
));
register
(
MEGAccessory
.
class
,
new
CosmeticConstant
(
"MEG"
,
"modelengine"
));
register
(
ParticleAccessory
.
class
,
new
CosmeticConstant
(
"PARTICLE"
,
"particle"
));
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/managers/back/BackManager.java
View file @
503691ab
...
...
@@ -32,6 +32,6 @@ public class BackManager extends MCCosmeticsManager<BackAccessory> {
@Override
public
void
equip
(
CosmeticProfile
profile
)
{
p
lugin
.
getVolatileCodeHandler
().
getBackHelper
().
applyBackPacket
(
profile
);
getP
lugin
()
.
getVolatileCodeHandler
().
getBackHelper
().
applyBackPacket
(
profile
);
}
}
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/managers/particle/ParticleManager.java
View file @
503691ab
...
...
@@ -8,8 +8,8 @@ import java.io.File;
public
class
ParticleManager
extends
MCCosmeticsManager
<
ParticleAccessory
>
{
public
ParticleManager
(
MCCosmeticsPlugin
plugin
,
Class
<
ParticleAccessory
>
meg
AccessoryClass
)
{
super
(
plugin
,
meg
AccessoryClass
);
public
ParticleManager
(
MCCosmeticsPlugin
plugin
,
Class
<
ParticleAccessory
>
particle
AccessoryClass
)
{
super
(
plugin
,
particle
AccessoryClass
);
}
@Override
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/players/ProfileInventory.java
View file @
503691ab
...
...
@@ -19,11 +19,8 @@ import java.util.Optional;
public
class
ProfileInventory
implements
CosmeticInventory
{
@Getter
private
transient
CosmeticProfile
profile
;
private
transient
Optl
<
Hat
>
equippedHat
;
private
transient
Optl
<
BackAccessory
>
equippedBack
;
private
transient
final
Map
<
String
,
Cosmetic
>
equippedCustom
=
Maps
.
newConcurrentMap
();
private
transient
final
Map
<
Class
<?
extends
Cosmetic
>,
Cosmetic
>
equipped
=
Maps
.
newConcurrentMap
();
@Getter
private
Map
<
String
,
List
<
String
>>
unlockedCosmetics
=
Maps
.
newConcurrentMap
();
@Getter
private
Map
<
String
,
String
>
equippedCosmetics
=
Maps
.
newConcurrentMap
();
...
...
@@ -49,12 +46,7 @@ public class ProfileInventory implements CosmeticInventory {
public
void
equip
(
Cosmetic
cosmetic
)
{
equippedCosmetics
.
put
(
cosmetic
.
getType
(),
cosmetic
.
getKey
());
if
(
cosmetic
instanceof
Hat
hat
)
{
equippedHat
=
Optl
.
of
(
hat
);
}
else
{
}
equipped
.
put
(
cosmetic
.
getClass
(),
cosmetic
);
cosmetic
.
getManager
().
equip
(
profile
);
}
...
...
@@ -63,23 +55,13 @@ public class ProfileInventory implements CosmeticInventory {
}
@Override
public
Optional
<
Cosmetic
>
getCustomEquipped
(
String
type
)
{
return
Optional
.
ofNullable
(
equippedCustom
.
getOrDefault
(
type
,
null
));
}
@Override
public
Optional
<
Cosmetic
>
getEquippedHat
()
{
return
Optional
.
ofNullable
(
equippedHat
.
orElseGet
(
null
));
public
Collection
<
String
>
getUnlocked
(
String
type
)
{
return
unlockedCosmetics
.
getOrDefault
(
type
,
Lists
.
newArrayList
());
}
@Override
public
Optional
<
Cosmetic
>
getEquipped
Back
(
)
{
return
Optional
.
ofNullable
(
equipped
Back
.
orElseGet
(
null
));
public
Optional
<
Cosmetic
>
getEquipped
(
Class
<?
extends
Cosmetic
>
tClass
)
{
return
Optional
.
ofNullable
(
equipped
.
get
(
tClass
));
}
@Override
public
Collection
<
String
>
getUnlocked
(
String
type
)
{
return
unlockedCosmetics
.
getOrDefault
(
type
,
Lists
.
newArrayList
());
}
}
This diff is collapsed.
Click to expand it.
v1_18/src/main/java/io/lumine/cosmetics/nms/v1_18_R1/cosmetic/VolatileHatImpl.java
View file @
503691ab
...
...
@@ -42,7 +42,7 @@ public class VolatileHatImpl implements VolatileHatHelper {
if
(
profile
==
null
)
return
;
Player
player
=
profile
.
getPlayer
();
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquippedHat
(
);
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquipped
(
Hat
.
class
);
if
(
cosmetic
.
isEmpty
()
||
!(
cosmetic
.
get
()
instanceof
ItemCosmetic
hat
))
return
;
...
...
This diff is collapsed.
Click to expand it.
v1_18_R2/pom.xml
View file @
503691ab
...
...
@@ -126,7 +126,7 @@
<dependency>
<groupId>
io.netty
</groupId>
<artifactId>
netty-all
</artifactId>
<version>
4.1.
25
.Final
</version>
<version>
4.1.
68
.Final
</version>
<scope>
provided
</scope>
</dependency>
...
...
This diff is collapsed.
Click to expand it.
v1_18_R2/src/main/java/io/lumine/cosmetics/nms/v1_18_R2/cosmetic/VolatileBackImpl.java
View file @
503691ab
...
...
@@ -5,6 +5,7 @@ import io.lumine.cosmetics.MCCosmeticsPlugin;
import
io.lumine.cosmetics.api.cosmetics.Cosmetic
;
import
io.lumine.cosmetics.api.cosmetics.ItemCosmetic
;
import
io.lumine.cosmetics.api.players.CosmeticProfile
;
import
io.lumine.cosmetics.managers.back.BackAccessory
;
import
io.lumine.cosmetics.nms.VolatileCodeEnabled_v1_18_R2
;
import
io.lumine.cosmetics.nms.cosmetic.VolatileBackHelper
;
import
io.netty.buffer.Unpooled
;
...
...
@@ -43,7 +44,7 @@ public class VolatileBackImpl implements VolatileBackHelper {
if
(
profile
==
null
)
return
;
Player
player
=
profile
.
getPlayer
();
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquippedBack
(
);
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquipped
(
Back
Accessory
.
class
);
if
(
cosmetic
.
isEmpty
()
||
!(
cosmetic
.
get
()
instanceof
ItemCosmetic
back
))
return
;
...
...
This diff is collapsed.
Click to expand it.
v1_18_R2/src/main/java/io/lumine/cosmetics/nms/v1_18_R2/cosmetic/VolatileHatImpl.java
View file @
503691ab
...
...
@@ -5,6 +5,7 @@ import io.lumine.cosmetics.MCCosmeticsPlugin;
import
io.lumine.cosmetics.api.cosmetics.Cosmetic
;
import
io.lumine.cosmetics.api.cosmetics.ItemCosmetic
;
import
io.lumine.cosmetics.api.players.CosmeticProfile
;
import
io.lumine.cosmetics.managers.hats.Hat
;
import
io.lumine.cosmetics.nms.VolatileCodeEnabled_v1_18_R2
;
import
io.lumine.cosmetics.nms.cosmetic.VolatileHatHelper
;
import
io.lumine.cosmetics.players.Profile
;
...
...
@@ -38,7 +39,7 @@ public class VolatileHatImpl implements VolatileHatHelper {
if
(
profile
==
null
)
return
;
Player
player
=
profile
.
getPlayer
();
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquippedHat
(
);
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquipped
(
Hat
.
class
);
if
(
cosmetic
.
isEmpty
()
||
!(
cosmetic
.
get
()
instanceof
ItemCosmetic
hat
))
return
;
...
...
@@ -67,7 +68,7 @@ public class VolatileHatImpl implements VolatileHatHelper {
if
(
profile
==
null
)
return
null
;
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquippedHat
(
);
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquipped
(
Hat
.
class
);
if
(
cosmetic
.
isEmpty
()
||
!(
cosmetic
.
get
()
instanceof
ItemCosmetic
hat
))
return
null
;
...
...
@@ -94,7 +95,7 @@ public class VolatileHatImpl implements VolatileHatHelper {
if
(
profile
==
null
)
return
equipmentPacket
;
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquippedHat
(
);
Optional
<
Cosmetic
>
cosmetic
=
profile
.
getCosmeticInventory
().
getEquipped
(
Hat
.
class
);
if
(
cosmetic
.
isEmpty
()
||
!(
cosmetic
.
get
()
instanceof
ItemCosmetic
hat
))
return
equipmentPacket
;
...
...
This diff is collapsed.
Click to expand it.
v1_18_R2/src/main/java/io/lumine/cosmetics/nms/v1_18_R2/network/VolatileChannelHandler.java
View file @
503691ab
...
...
@@ -3,6 +3,7 @@ package io.lumine.cosmetics.nms.v1_18_R2.network;
import
io.lumine.cosmetics.MCCosmeticsPlugin
;
import
io.lumine.cosmetics.api.cosmetics.Cosmetic
;
import
io.lumine.cosmetics.api.cosmetics.ItemCosmetic
;
import
io.lumine.cosmetics.managers.back.BackAccessory
;
import
io.lumine.cosmetics.nms.VolatileCodeEnabled_v1_18_R2
;
import
io.lumine.cosmetics.players.Profile
;
import
io.netty.channel.ChannelDuplexHandler
;
...
...
@@ -55,7 +56,7 @@ public class VolatileChannelHandler extends ChannelDuplexHandler {
private
void
handleSpawn
(
Profile
profile
)
{
Optional
<
Cosmetic
>
maybeBack
=
profile
.
getCosmeticInventory
().
getEquippedBack
(
);
Optional
<
Cosmetic
>
maybeBack
=
profile
.
getCosmeticInventory
().
getEquipped
(
Back
Accessory
.
class
);
if
(
maybeBack
.
isPresent
()
&&
maybeBack
.
get
()
instanceof
ItemCosmetic
)
{
nmsHandler
.
getBackHelper
().
respawnForPlayer
(
profile
.
getPlayer
(),
player
);
}
...
...
@@ -64,7 +65,7 @@ public class VolatileChannelHandler extends ChannelDuplexHandler {
private
void
handleDespawn
(
Profile
profile
)
{
Optional
<
Cosmetic
>
maybeBack
=
profile
.
getCosmeticInventory
().
getEquippedBack
(
);
Optional
<
Cosmetic
>
maybeBack
=
profile
.
getCosmeticInventory
().
getEquipped
(
Back
Accessory
.
class
);
if
(
maybeBack
.
isPresent
()
&&
maybeBack
.
get
()
instanceof
ItemCosmetic
)
{
nmsHandler
.
getBackHelper
().
despawnForPlayer
(
profile
.
getPlayer
(),
player
);
}
...
...
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