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
f4ada349
Commit
f4ada349
authored
2 years ago
by
Ashijin
Browse files
Options
Download
Email Patches
Plain Diff
Fixed accessories/backpacks sometimes disappearing after teleporting
parent
fa1ebd04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
plugin/src/main/java/io/lumine/cosmetics/managers/back/BackManager.java
...n/java/io/lumine/cosmetics/managers/back/BackManager.java
+16
-0
plugin/src/main/java/io/lumine/cosmetics/managers/modelengine/MEGManager.java
.../io/lumine/cosmetics/managers/modelengine/MEGManager.java
+16
-0
No files found.
plugin/src/main/java/io/lumine/cosmetics/managers/back/BackManager.java
View file @
f4ada349
...
...
@@ -18,6 +18,7 @@ import java.io.File;
import
org.bukkit.GameMode
;
import
org.bukkit.event.player.PlayerChangedWorldEvent
;
import
org.bukkit.event.player.PlayerGameModeChangeEvent
;
import
org.bukkit.event.player.PlayerTeleportEvent
;
public
class
BackManager
extends
MCCosmeticsManager
<
BackAccessory
>
implements
HideableCosmetic
{
...
...
@@ -45,6 +46,21 @@ public class BackManager extends MCCosmeticsManager<BackAccessory> implements Hi
})
.
bindWith
(
this
);
Events
.
subscribe
(
PlayerTeleportEvent
.
class
)
.
handler
(
event
->
{
final
var
player
=
event
.
getPlayer
();
final
var
profile
=
plugin
.
getProfiles
().
getProfile
(
player
);
if
(
profile
.
getEquipped
(
BackAccessory
.
class
).
isPresent
())
{
unequip
(
profile
);
Schedulers
.
sync
().
runLater
(()
->
{
equip
(
profile
);
},
5
);
}
})
.
bindWith
(
this
);
Events
.
subscribe
(
PlayerGameModeChangeEvent
.
class
)
.
handler
(
event
->
{
if
(
event
.
getNewGameMode
()
==
GameMode
.
SPECTATOR
)
{
...
...
This diff is collapsed.
Click to expand it.
plugin/src/main/java/io/lumine/cosmetics/managers/modelengine/MEGManager.java
View file @
f4ada349
...
...
@@ -18,6 +18,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import
org.bukkit.event.player.PlayerChangedWorldEvent
;
import
org.bukkit.event.player.PlayerQuitEvent
;
import
org.bukkit.event.player.PlayerRespawnEvent
;
import
org.bukkit.event.player.PlayerTeleportEvent
;
import
java.io.File
;
...
...
@@ -72,6 +73,21 @@ public class MEGManager extends MCCosmeticsManager<MEGAccessory> {
})
.
bindWith
(
this
);
Events
.
subscribe
(
PlayerTeleportEvent
.
class
)
.
handler
(
event
->
{
final
var
player
=
event
.
getPlayer
();
final
var
profile
=
plugin
.
getProfiles
().
getProfile
(
player
);
if
(
profile
.
getEquipped
(
MEGAccessory
.
class
).
isPresent
())
{
unequip
(
profile
);
Schedulers
.
sync
().
runLater
(()
->
{
equip
(
profile
);
},
5
);
}
})
.
bindWith
(
this
);
Events
.
subscribe
(
PlayerQuitEvent
.
class
)
.
handler
(
event
->
{
final
Player
player
=
event
.
getPlayer
();
...
...
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