Skip to content

Commit 9898f94

Browse files
committed
Shutdown service and close h2 connection
1 parent e8f7089 commit 9898f94

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>ru.leymooo</groupId>
88
<artifactId>simpleskins</artifactId>
9-
<version>1.0.0</version>
9+
<version>1.0.1</version>
1010
<packaging>jar</packaging>
1111

1212
<name>SimpleSkins</name>

src/main/java/ru/leymooo/simpleskins/SimpleSkins.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,16 @@
2727
import java.util.concurrent.ExecutorService;
2828
import java.util.concurrent.Executors;
2929
import java.util.concurrent.Future;
30+
import java.util.concurrent.TimeUnit;
31+
import java.util.logging.Level;
3032

3133
import net.kyori.text.serializer.ComponentSerializers;
3234
import net.md_5.bungee.config.Configuration;
3335
import net.md_5.bungee.config.ConfigurationProvider;
3436
import net.md_5.bungee.config.YamlConfiguration;
3537
import ru.leymooo.simpleskins.command.SkinCommand;
3638

37-
@Plugin(id = "simpleskins", name = "SimpleSkins", version = "1.0.0",
39+
@Plugin(id = "simpleskins", name = "SimpleSkins", version = "1.0.1",
3840
description = "Simple skins restorer plugin for velocity",
3941
authors = "Leymooo")
4042
public class SimpleSkins {
@@ -58,7 +60,7 @@ public SimpleSkins(ProxyServer server, Logger logger, @DataDirectory Path userCo
5860

5961
@Subscribe
6062
public void onProxyInitialize(ProxyInitializeEvent event) {
61-
logger.info("Enabling SimspleSkins version 1.0.0");
63+
logger.info("Enabling SimpleSkins");
6264

6365
if (!loadConfig()) {
6466
server.getEventManager().unregisterListeners(this);
@@ -69,15 +71,21 @@ public void onProxyInitialize(ProxyInitializeEvent event) {
6971
this.dataBaseUtils = new DataBaseUtils(this);
7072

7173
this.server.getCommandManager().register(new SkinCommand(this), "skin");
72-
//Config
73-
//Command
74+
logger.info("SimpleSkins enabled");
7475
}
7576

7677
@Subscribe
7778
public void onShutDown(ProxyShutdownEvent ev) {
78-
79+
logger.info("Disabling SimpleSkins");
80+
this.dataBaseUtils.closeConnection();
81+
this.service.shutdownNow();
82+
try {
83+
this.service.awaitTermination(5000, TimeUnit.MILLISECONDS);
84+
} catch (InterruptedException ex) {
85+
}
86+
logger.info("SimpleSkins disabled");
7987
}
80-
88+
8189
@Subscribe
8290
public void onGameProfileRequest(GameProfileRequestEvent event) {
8391
if (!event.isOnlineMode()) {

0 commit comments

Comments
 (0)