Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cedar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Private MC Server
previous-src
Cedar
Commits
c77828fe
Commit
c77828fe
authored
8 years ago
by
Spotlight Deveaux
Browse files
Options
Downloads
Patches
Plain Diff
Redo startup method
parent
52938e17
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/io/github/packserver/RegPlug/Main.java
+35
-7
35 additions, 7 deletions
src/io/github/packserver/RegPlug/Main.java
with
35 additions
and
7 deletions
src/io/github/packserver/RegPlug/Main.java
+
35
−
7
View file @
c77828fe
...
...
@@ -9,28 +9,56 @@
package
io.github.packserver.RegPlug
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.bukkit.configuration.file.FileConfiguration
;
import
org.bukkit.configuration.file.YamlConfiguration
;
import
org.bukkit.event.Listener
;
import
org.bukkit.plugin.java.JavaPlugin
;
public
class
Main
extends
JavaPlugin
implements
Listener
{
// Fired when plugin is disabled
@Override
public
void
onDisable
()
{
/**
* Global debug mode
*/
static
Boolean
DEBUG
;
}
/**
* Plugin instance
*/
static
Main
plugin
;
// Fired when plugin is first enabled
/**
* Fired when plugin is first enabled
*/
@Override
public
void
onEnable
()
{
// Create plugin instance and hand it to plugin
plugin
=
this
;
// Try to run websocket server
try
{
WebServer
.
runServer
();
WebsocketServer
.
runServer
();
}
catch
(
InterruptedException
|
IOException
ex
)
{
Logger
.
getLogger
(
Main
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
this
.
getCommand
(
"reg"
).
setExecutor
(
new
RegistrationExecutorThingy
(
this
));
// Debug mode
// Find if we are in debug mode or not
InputStream
in
=
getClass
().
getResourceAsStream
(
"/config.yml"
);
FileConfiguration
config
=
YamlConfiguration
.
loadConfiguration
(
in
);
DEBUG
=
config
.
getBoolean
(
"debug"
);
}
/**
* Fired when plugin is disabled
*/
@Override
public
void
onDisable
()
{
try
{
WebsocketServer
.
server
.
stop
();
}
catch
(
IOException
|
InterruptedException
ex
)
{
Logger
.
getLogger
(
Main
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment