Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
03a28762
Commit
03a28762
authored
May 11, 2022
by
KingRainbow44
Browse files
Add plugin loggers
parent
d215035f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/plugin/Plugin.java
View file @
03a28762
...
...
@@ -3,6 +3,8 @@ package emu.grasscutter.plugin;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.plugin.api.ServerHook
;
import
emu.grasscutter.server.game.GameServer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
import
java.io.InputStream
;
...
...
@@ -19,6 +21,7 @@ public abstract class Plugin {
private
PluginIdentifier
identifier
;
private
URLClassLoader
classLoader
;
private
File
dataFolder
;
private
Logger
logger
;
/**
* This method is reflected into.
...
...
@@ -35,6 +38,7 @@ public abstract class Plugin {
this
.
identifier
=
identifier
;
this
.
classLoader
=
classLoader
;
this
.
dataFolder
=
new
File
(
PLUGINS_FOLDER
,
identifier
.
name
);
this
.
logger
=
LoggerFactory
.
getLogger
(
identifier
.
name
);
if
(!
this
.
dataFolder
.
exists
()
&&
!
this
.
dataFolder
.
mkdirs
())
{
Grasscutter
.
getLogger
().
warn
(
"Failed to create plugin data folder for "
+
this
.
identifier
.
name
);
...
...
@@ -104,6 +108,14 @@ public abstract class Plugin {
return
this
.
server
;
}
/**
* Returns the plugin's logger.
* @return A SLF4J logger.
*/
public
final
Logger
getLogger
()
{
return
this
.
logger
;
}
/* Called when the plugin is first loaded. */
public
void
onLoad
()
{
}
/* Called after (most of) the server enables. */
...
...
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