mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-27 00:45:40 +01:00
Moved /mmocore admin transferdata
This commit is contained in:
parent
a7e2773ff7
commit
7c79f9cee3
@ -6,7 +6,6 @@ import net.Indyuce.mmocore.MMOCore;
|
|||||||
import net.Indyuce.mmocore.command.rpg.CoinsCommandTreeNode;
|
import net.Indyuce.mmocore.command.rpg.CoinsCommandTreeNode;
|
||||||
import net.Indyuce.mmocore.command.rpg.NoteCommandTreeNode;
|
import net.Indyuce.mmocore.command.rpg.NoteCommandTreeNode;
|
||||||
import net.Indyuce.mmocore.command.rpg.ReloadCommandTreeNode;
|
import net.Indyuce.mmocore.command.rpg.ReloadCommandTreeNode;
|
||||||
import net.Indyuce.mmocore.command.rpg.TransferDataTreeNode;
|
|
||||||
import net.Indyuce.mmocore.command.rpg.admin.AdminCommandTreeNode;
|
import net.Indyuce.mmocore.command.rpg.admin.AdminCommandTreeNode;
|
||||||
import net.Indyuce.mmocore.command.rpg.booster.BoosterCommandTreeNode;
|
import net.Indyuce.mmocore.command.rpg.booster.BoosterCommandTreeNode;
|
||||||
import net.Indyuce.mmocore.command.rpg.debug.DebugCommandTreeNode;
|
import net.Indyuce.mmocore.command.rpg.debug.DebugCommandTreeNode;
|
||||||
@ -27,7 +26,6 @@ public class MMOCoreCommandTreeRoot extends CommandTreeRoot implements CommandEx
|
|||||||
super("mmocore", "mmocore.admin");
|
super("mmocore", "mmocore.admin");
|
||||||
|
|
||||||
addChild(new ReloadCommandTreeNode(this));
|
addChild(new ReloadCommandTreeNode(this));
|
||||||
addChild(new TransferDataTreeNode(this));
|
|
||||||
addChild(new CoinsCommandTreeNode(this));
|
addChild(new CoinsCommandTreeNode(this));
|
||||||
addChild(new NoteCommandTreeNode(this));
|
addChild(new NoteCommandTreeNode(this));
|
||||||
addChild(new AdminCommandTreeNode(this));
|
addChild(new AdminCommandTreeNode(this));
|
||||||
|
@ -15,6 +15,7 @@ public class AdminCommandTreeNode extends CommandTreeNode {
|
|||||||
addChild(new InfoCommandTreeNode(this));
|
addChild(new InfoCommandTreeNode(this));
|
||||||
addChild(new ClassCommandTreeNode(this));
|
addChild(new ClassCommandTreeNode(this));
|
||||||
addChild(new ForceClassCommandTreeNode(this));
|
addChild(new ForceClassCommandTreeNode(this));
|
||||||
|
addChild(new TransferDataTreeNode(this));
|
||||||
|
|
||||||
addChild(new ExperienceCommandTreeNode(this));
|
addChild(new ExperienceCommandTreeNode(this));
|
||||||
addChild(new LevelCommandTreeNode(this));
|
addChild(new LevelCommandTreeNode(this));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package net.Indyuce.mmocore.command.rpg;
|
package net.Indyuce.mmocore.command.rpg.admin;
|
||||||
|
|
||||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
@ -12,19 +12,17 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This command allows to transfer data from your actual datatype (yaml or sql) to the other one to make a change
|
* This command allows to transfer data from your actual storage type
|
||||||
* in the data storage type.
|
* to the other one which lets the user switch between storage types.
|
||||||
*/
|
*/
|
||||||
public class TransferDataTreeNode extends CommandTreeNode {
|
public class TransferDataTreeNode extends CommandTreeNode {
|
||||||
|
|
||||||
|
|
||||||
public TransferDataTreeNode(CommandTreeNode parent) {
|
public TransferDataTreeNode(CommandTreeNode parent) {
|
||||||
super(parent, "transferdata");
|
super(parent, "transferdata");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(CommandSender commandSender, String[] strings) {
|
public CommandResult execute(CommandSender commandSender, String[] strings) {
|
||||||
DataProvider provider=null;
|
DataProvider provider = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -46,7 +44,7 @@ public class TransferDataTreeNode extends CommandTreeNode {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
commandSender.sendMessage("Couldn't transfer properly the data.");
|
commandSender.sendMessage("Couldn't transfer properly the data.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if(provider!=null&&provider instanceof MySQLDataProvider) {
|
if (provider != null && provider instanceof MySQLDataProvider) {
|
||||||
((MySQLDataProvider) provider).close();
|
((MySQLDataProvider) provider).close();
|
||||||
}
|
}
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
@ -58,14 +56,12 @@ public class TransferDataTreeNode extends CommandTreeNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(finalProvider !=null&& finalProvider instanceof MySQLDataProvider) {
|
if (finalProvider != null && finalProvider instanceof MySQLDataProvider) {
|
||||||
((MySQLDataProvider) finalProvider).close();
|
((MySQLDataProvider) finalProvider).close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(MMOCore.plugin,200);
|
}.runTaskLater(MMOCore.plugin, 200);
|
||||||
|
|
||||||
|
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,7 +8,6 @@ import net.Indyuce.mmocore.manager.data.yaml.YAMLGuildDataManager;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
public class MySQLDataProvider extends MMODataSource implements DataProvider {
|
public class MySQLDataProvider extends MMODataSource implements DataProvider {
|
||||||
private final MySQLPlayerDataManager playerManager = new MySQLPlayerDataManager(this);
|
private final MySQLPlayerDataManager playerManager = new MySQLPlayerDataManager(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user