Skip to content

Commit

Permalink
Merge pull request #15 from arcadelabs/labaide-impl
Browse files Browse the repository at this point in the history
ArcadeLibs -> Labaide migration.
  • Loading branch information
RealRONiN authored Jul 12, 2022
2 parents 593212b + 4369ca3 commit e57df46
Show file tree
Hide file tree
Showing 35 changed files with 894 additions and 686 deletions.
20 changes: 2 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<!-- <relocations>-->
<!-- <relocation>-->
<!-- <pattern>com.jeff_media.morepersistentdatatypes</pattern>-->
<!-- <shadedPattern>in.arcadelabs.libs.morepersistentdatatypes</shadedPattern>-->
<!-- </relocation>-->
<!-- </relocations>-->
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -97,19 +91,9 @@
</dependency>
<dependency>
<groupId>com.github.arcadelabs</groupId>
<artifactId>ArcadeLibs</artifactId>
<version>ff9d85bc708f21d63485ccfe02a7e4b51a71c7cb</version>
<artifactId>LabAide</artifactId>
<version>pre-3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xyz.xenondevs</groupId>
<artifactId>particle</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.0.1</version>
</dependency>
</dependencies>
</project>
30 changes: 15 additions & 15 deletions src/main/java/in/arcadelabs/lifesteal/LifeSteal.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,19 +18,19 @@

package in.arcadelabs.lifesteal;

import in.arcadelabs.arcadelibs.metrics.BStats;
import in.arcadelabs.arcadelibs.placeholder.Placeholder;
import in.arcadelabs.arcadelibs.updatechecker.UpdateChecker;
import in.arcadelabs.libs.adventurelib.impl.SpigotMessenger;
import in.arcadelabs.libs.aikar.acf.BaseCommand;
import in.arcadelabs.libs.aikar.acf.BukkitCommandManager;
import in.arcadelabs.libs.aikar.acf.PaperCommandManager;
import in.arcadelabs.libs.boostedyaml.YamlDocument;
import in.arcadelabs.libs.boostedyaml.dvs.versioning.BasicVersioning;
import in.arcadelabs.libs.boostedyaml.settings.dumper.DumperSettings;
import in.arcadelabs.libs.boostedyaml.settings.general.GeneralSettings;
import in.arcadelabs.libs.boostedyaml.settings.loader.LoaderSettings;
import in.arcadelabs.libs.boostedyaml.settings.updater.UpdaterSettings;
import in.arcadelabs.labaide.libs.adventurelib.impl.SpigotMessenger;
import in.arcadelabs.labaide.libs.aikar.acf.BaseCommand;
import in.arcadelabs.labaide.libs.aikar.acf.BukkitCommandManager;
import in.arcadelabs.labaide.libs.aikar.acf.PaperCommandManager;
import in.arcadelabs.labaide.libs.boostedyaml.YamlDocument;
import in.arcadelabs.labaide.libs.boostedyaml.dvs.versioning.BasicVersioning;
import in.arcadelabs.labaide.libs.boostedyaml.settings.dumper.DumperSettings;
import in.arcadelabs.labaide.libs.boostedyaml.settings.general.GeneralSettings;
import in.arcadelabs.labaide.libs.boostedyaml.settings.loader.LoaderSettings;
import in.arcadelabs.labaide.libs.boostedyaml.settings.updater.UpdaterSettings;
import in.arcadelabs.labaide.metrics.BStats;
import in.arcadelabs.labaide.placeholder.Placeholder;
import in.arcadelabs.labaide.updatechecker.UpdateChecker;
import in.arcadelabs.lifesteal.commands.Eliminate;
import in.arcadelabs.lifesteal.commands.GiveHearts;
import in.arcadelabs.lifesteal.commands.Reload;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/in/arcadelabs/lifesteal/LifeStealPlugin.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/in/arcadelabs/lifesteal/commands/Eliminate.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,11 +18,11 @@

package in.arcadelabs.lifesteal.commands;

import in.arcadelabs.libs.aikar.acf.BaseCommand;
import in.arcadelabs.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.libs.aikar.acf.annotation.CommandCompletion;
import in.arcadelabs.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.labaide.libs.aikar.acf.BaseCommand;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandCompletion;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.lifesteal.LifeSteal;
import in.arcadelabs.lifesteal.LifeStealPlugin;
import org.bukkit.entity.Player;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/in/arcadelabs/lifesteal/commands/GiveHearts.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,11 +18,11 @@

package in.arcadelabs.lifesteal.commands;

import in.arcadelabs.libs.aikar.acf.BaseCommand;
import in.arcadelabs.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.libs.aikar.acf.annotation.CommandCompletion;
import in.arcadelabs.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.labaide.libs.aikar.acf.BaseCommand;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandCompletion;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.lifesteal.LifeSteal;
import in.arcadelabs.lifesteal.LifeStealPlugin;
import org.bukkit.command.CommandSender;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/in/arcadelabs/lifesteal/commands/Reload.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,11 +18,11 @@

package in.arcadelabs.lifesteal.commands;

import in.arcadelabs.libs.aikar.acf.BaseCommand;
import in.arcadelabs.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.libs.aikar.acf.annotation.Description;
import in.arcadelabs.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.labaide.libs.aikar.acf.BaseCommand;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.Description;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.lifesteal.LifeSteal;
import in.arcadelabs.lifesteal.LifeStealPlugin;
import org.bukkit.command.CommandSender;
Expand All @@ -40,7 +40,7 @@ public class Reload extends BaseCommand {
* On reload command.
*
* @param sender the sender
* @throws IOException the io exception
* @throws IOException the io exception
*/
@Subcommand("reload")
@Description("Reloads the instance")
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/in/arcadelabs/lifesteal/commands/SetHearts.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,11 +18,11 @@

package in.arcadelabs.lifesteal.commands;

import in.arcadelabs.libs.aikar.acf.BaseCommand;
import in.arcadelabs.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.libs.aikar.acf.annotation.CommandCompletion;
import in.arcadelabs.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.labaide.libs.aikar.acf.BaseCommand;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandCompletion;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.lifesteal.LifeSteal;
import in.arcadelabs.lifesteal.LifeStealPlugin;
import org.bukkit.entity.Player;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/in/arcadelabs/lifesteal/commands/Withdraw.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,10 +18,10 @@

package in.arcadelabs.lifesteal.commands;

import in.arcadelabs.libs.aikar.acf.BaseCommand;
import in.arcadelabs.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.labaide.libs.aikar.acf.BaseCommand;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandAlias;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.CommandPermission;
import in.arcadelabs.labaide.libs.aikar.acf.annotation.Subcommand;
import in.arcadelabs.lifesteal.LifeSteal;
import in.arcadelabs.lifesteal.LifeStealPlugin;
import in.arcadelabs.lifesteal.hearts.HeartItemManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package in.arcadelabs.lifesteal.database;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import in.arcadelabs.libs.boostedyaml.YamlDocument;
import in.arcadelabs.labaide.libs.boostedyaml.YamlDocument;
import in.arcadelabs.lifesteal.LifeStealPlugin;
import lombok.Getter;

Expand Down Expand Up @@ -53,8 +71,8 @@ public DatabaseHandler(LifeStealPlugin lifeStealPlugin) {
lifeStealPlugin.getLogger().info("Successfully initialized connection to MySQL database...");
} else {
lifeStealPlugin
.getLogger()
.severe("Failed to initialize connection to MySQL database! Shutting down...");
.getLogger()
.severe("Failed to initialize connection to MySQL database! Shutting down...");
lifeStealPlugin.getServer().getPluginManager().disablePlugin(lifeStealPlugin);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package in.arcadelabs.lifesteal.database.profile;

import in.arcadelabs.lifesteal.utils.LifeState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
/*
* LifeSteal - Yet another lifecore smp core.
* Copyright (C) 2022 Arcade Labs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package in.arcadelabs.lifesteal.database.profile;

import in.arcadelabs.lifesteal.LifeStealPlugin;
import java.sql.SQLException;
import java.util.Objects;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
Expand All @@ -12,6 +27,8 @@
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.PlayerQuitEvent;

import java.sql.SQLException;

public class ProfileListener implements Listener {

@EventHandler(priority = EventPriority.HIGHEST)
Expand All @@ -20,20 +37,20 @@ public void onPlayerLoginEvent(PlayerLoginEvent event) {
if (event.getResult() != Result.ALLOWED) return;

if (!(LifeStealPlugin.getInstance()
.getServer()
.getPluginManager()
.isPluginEnabled(LifeStealPlugin.getInstance()))) {
.getServer()
.getPluginManager()
.isPluginEnabled(LifeStealPlugin.getInstance()))) {
event.disallow(Result.KICK_OTHER, "Server still loading, please join after some time");
}
try {
Profile profile =
LifeStealPlugin.getLifeSteal()
.getProfileManager()
.getProfile(event.getPlayer().getUniqueId());
LifeStealPlugin.getLifeSteal()
.getProfileManager()
.getProfile(event.getPlayer().getUniqueId());
LifeStealPlugin.getLifeSteal()
.getProfileManager()
.getProfileMap()
.put(profile.getUniqueID(), profile);
.getProfileManager()
.getProfileMap()
.put(profile.getUniqueID(), profile);
} catch (SQLException e) {
event.disallow(Result.KICK_OTHER, "Your account could not be loaded...");
e.printStackTrace();
Expand All @@ -43,25 +60,25 @@ public void onPlayerLoginEvent(PlayerLoginEvent event) {
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerQuit(PlayerQuitEvent event) {
Bukkit.getScheduler()
.runTaskAsynchronously(
LifeStealPlugin.getInstance(),
() -> {
try {
LifeStealPlugin.getLifeSteal()
.getProfileManager()
.saveProfile(
.runTaskAsynchronously(
LifeStealPlugin.getInstance(),
() -> {
try {
LifeStealPlugin.getLifeSteal()
.getProfileManager()
.getProfileMap()
.get(event.getPlayer().getUniqueId()));
} catch (SQLException e) {
e.printStackTrace();
}
.getProfileManager()
.saveProfile(
LifeStealPlugin.getLifeSteal()
.getProfileManager()
.getProfileMap()
.get(event.getPlayer().getUniqueId()));
} catch (SQLException e) {
e.printStackTrace();
}

LifeStealPlugin.getLifeSteal()
.getProfileManager()
.getProfileMap()
.remove(event.getPlayer().getPlayer().getUniqueId());
});
LifeStealPlugin.getLifeSteal()
.getProfileManager()
.getProfileMap()
.remove(event.getPlayer().getPlayer().getUniqueId());
});
}
}
Loading

0 comments on commit e57df46

Please sign in to comment.