-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a9a899
commit 8d51cca
Showing
6 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/io/typst/bukkit/glow/modelengine/ModelEngineAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.typst.bukkit.glow.modelengine; | ||
|
||
import com.ticxo.modelengine.api.ModelEngineAPI; | ||
import com.ticxo.modelengine.api.model.ActiveModel; | ||
import com.ticxo.modelengine.api.model.ModeledEntity; | ||
import org.bukkit.ChatColor; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* for lazy access due the soft depend | ||
*/ | ||
public class ModelEngineAccessor { | ||
public static void setGlowing(UUID ownerId, ChatColor color) { | ||
ModeledEntity modeledEntity = ModelEngineAPI.getModeledEntity(ownerId); | ||
if (modeledEntity == null) { | ||
return; | ||
} | ||
for (ActiveModel model : modeledEntity.getModels().values()) { | ||
model.setGlowing(true); | ||
model.setGlowColor((int) color.getChar()); | ||
} | ||
} | ||
|
||
public static void removeGlowing(UUID ownerId) { | ||
ModeledEntity modeledEntity = ModelEngineAPI.getModeledEntity(ownerId); | ||
if (modeledEntity == null) { | ||
return; | ||
} | ||
for (ActiveModel model : modeledEntity.getModels().values()) { | ||
model.setGlowing(false); | ||
} | ||
} | ||
} |