-
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
8d51cca
commit 9da8d3f
Showing
7 changed files
with
190 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ plugins { | |
} | ||
|
||
group = 'io.typst' | ||
version = '2.1.0' | ||
version = '2.1.1' | ||
|
||
repositories { | ||
mavenCentral() | ||
|
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
57 changes: 57 additions & 0 deletions
57
src/main/java/io/typst/bukkit/glow/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,57 @@ | ||
package io.typst.bukkit.glow; | ||
|
||
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 | ||
*/ | ||
class ModelEngineAccessor { | ||
public static void setGlowing(UUID ownerId, ChatColor color) { | ||
ModeledEntity modeledEntity = ModelEngineAPI.getModeledEntity(ownerId); | ||
if (modeledEntity == null) { | ||
return; | ||
} | ||
int rgb = getRGBFromChatColor(color); | ||
for (ActiveModel model : modeledEntity.getModels().values()) { | ||
model.setGlowColor(rgb); // NOTE: ME seems to use ItemDisplay for glowing not scoreboard | ||
model.setGlowing(true); | ||
} | ||
} | ||
|
||
public static void removeGlowing(UUID ownerId) { | ||
ModeledEntity modeledEntity = ModelEngineAPI.getModeledEntity(ownerId); | ||
if (modeledEntity == null) { | ||
return; | ||
} | ||
for (ActiveModel model : modeledEntity.getModels().values()) { | ||
model.setGlowing(false); | ||
} | ||
} | ||
|
||
// Reference: https://wiki.vg/Text_formatting#Colors | ||
private static int getRGBFromChatColor(ChatColor color) { | ||
return switch (color) { | ||
case BLACK -> 0x000000; | ||
case DARK_BLUE -> 0x0000aa; | ||
case DARK_GREEN -> 0x00aa00; | ||
case DARK_AQUA -> 0x00aaaa; | ||
case DARK_RED -> 0xaa0000; | ||
case DARK_PURPLE -> 0xaa00aa; | ||
case GOLD -> 0xffaa00; | ||
case GRAY -> 0xaaaaaa; | ||
case DARK_GRAY -> 0x555555; | ||
case BLUE -> 0x5555ff; | ||
case GREEN -> 0x55ff55; | ||
case AQUA -> 0x55ffff; | ||
case RED -> 0xff5555; | ||
case LIGHT_PURPLE -> 0xff55ff; | ||
case YELLOW -> 0xffff55; | ||
default -> 0xffffff; | ||
}; | ||
} | ||
} |
34 changes: 0 additions & 34 deletions
34
src/main/java/io/typst/bukkit/glow/modelengine/ModelEngineAccessor.java
This file was deleted.
Oops, something went wrong.