Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Linus K.
McPlugins
Commits
4ada3819
Commit
4ada3819
authored
Oct 24, 2020
by
Linus K.
Browse files
Add autocolor for signs
parent
82b0bf29
Pipeline
#123
failed with stage
in 2 minutes and 2 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
AutoSyston/src/me/linuscde/mcplugins/autosyston/Plugin.kt
View file @
4ada3819
...
...
@@ -47,6 +47,7 @@ class Plugin: JavaPlugin() {
fun
registerListeners
()
{
val
pm
=
Bukkit
.
getPluginManager
()
pm
.
registerEvents
(
AutoFarmerListener
(),
this
)
pm
.
registerEvents
(
ColoredSignsListener
(),
this
)
}
fun
registerSchedulers
()
{
...
...
AutoSyston/src/me/linuscde/mcplugins/autosyston/listeners/ColoredSignsListener.kt
0 → 100644
View file @
4ada3819
package
me.linuscde.mcplugins.autosyston.listeners
import
org.bukkit.ChatColor
import
org.bukkit.event.EventHandler
import
org.bukkit.event.Listener
import
org.bukkit.event.block.SignChangeEvent
class
ColoredSignsListener
:
Listener
{
@EventHandler
fun
onSignChange
(
e
:
SignChangeEvent
)
{
// Don't color if this might be a prefix of a custom plugin
if
(
e
.
getLine
(
0
)
?.
contains
(
"["
)
==
true
&&
e
.
getLine
(
0
)
?.
contains
(
"]"
)
==
true
)
return
if
(
e
.
getLine
(
0
)
?.
contains
(
"<"
)
==
true
&&
e
.
getLine
(
0
)
?.
contains
(
">"
)
==
true
)
return
// Color lines
for
(
i
in
0
..
3
)
{
val
line
=
e
.
getLine
(
i
)
?:
continue
if
(
'&'
in
line
)
e
.
setLine
(
i
,
ChatColor
.
translateAlternateColorCodes
(
'&'
,
line
));
}
}
}
\ No newline at end of file
pom.xml
View file @
4ada3819
...
...
@@ -16,7 +16,7 @@
<maven.compiler.target>
1.8
</maven.compiler.target>
<revision>
0.1.0-SNAPSHOT
</revision>
<mcplugins.autosyston.version>
0.
1
.0
</mcplugins.autosyston.version>
<mcplugins.autosyston.version>
0.
2
.0
</mcplugins.autosyston.version>
<mcplugins.kotlin.version>
1.0.0
</mcplugins.kotlin.version>
<mcplugins.teleportastic.version>
0.3.0
</mcplugins.teleportastic.version>
...
...
Write
Preview
Supports
Markdown
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