fixed #16
This commit is contained in:
parent
41298da321
commit
37218c4c58
|
|
@ -3,4 +3,4 @@
|
||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs=-Xmx3G
|
||||||
org.gradle.daemon=false
|
org.gradle.daemon=false
|
||||||
|
|
||||||
mod_version=1.20.1-1.3.1a
|
mod_version=1.20.1-1.3.2
|
||||||
|
|
@ -27,29 +27,27 @@ public class ModsSupport {
|
||||||
ResultSet resultSet = queryResult.getResultSet();
|
ResultSet resultSet = queryResult.getResultSet();
|
||||||
if(resultSet.next()) {
|
if(resultSet.next()) {
|
||||||
String curios_data=resultSet.getString("curios_item");
|
String curios_data=resultSet.getString("curios_item");
|
||||||
if(curios_data.length()>2) {
|
itemHandler.ifPresent(handler ->{
|
||||||
Map<Integer, String> curios = LocalJsonUtil.StringToEntryMap(curios_data);
|
|
||||||
itemHandler.ifPresent(handler -> {
|
|
||||||
handler.reset();
|
|
||||||
for (int i = 0; i < handler.getSlots(); i++) {
|
|
||||||
try {
|
|
||||||
handler.getEquippedCurios().setStackInSlot(i,ItemStack.EMPTY);
|
|
||||||
if (curios.get(i) != null){
|
|
||||||
handler.getEquippedCurios().setStackInSlot(i, ItemStack.of(NbtUtils.snbtToStructure(curios.get(i).replace("|", ","))));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (CommandSyntaxException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else {
|
|
||||||
itemHandler.ifPresent(handler ->{
|
|
||||||
for (int i = 0; i < handler.getSlots(); i++) {
|
for (int i = 0; i < handler.getSlots(); i++) {
|
||||||
handler.getEquippedCurios().setStackInSlot(i,ItemStack.EMPTY);
|
handler.getEquippedCurios().setStackInSlot(i,ItemStack.EMPTY);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<Integer, String> curios = LocalJsonUtil.StringToEntryMap(curios_data);
|
||||||
|
itemHandler.ifPresent(handler -> {
|
||||||
|
handler.reset();
|
||||||
|
for (int i = 0; i < handler.getSlots(); i++) {
|
||||||
|
try {
|
||||||
|
if (curios.get(i) != null){
|
||||||
|
handler.getEquippedCurios().setStackInSlot(i, ItemStack.of(NbtUtils.snbtToStructure(curios.get(i).replace("|", ","))));
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (CommandSyntaxException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
resultSet.close();
|
resultSet.close();
|
||||||
queryResult.getConnection().close();
|
queryResult.getConnection().close();
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.event.server.ServerStoppedEvent;
|
import net.minecraftforge.event.server.ServerStoppedEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.Event;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import vip.fubuki.playersync.config.JdbcConfig;
|
import vip.fubuki.playersync.config.JdbcConfig;
|
||||||
|
|
@ -52,7 +53,7 @@ public class VanillaSync {
|
||||||
int lastServer = resultSet.getInt("last_server");
|
int lastServer = resultSet.getInt("last_server");
|
||||||
queryResult=JDBCsetUp.executeQuery("SELECT * FROM player_data WHERE uuid='"+player_uuid+"'");
|
queryResult=JDBCsetUp.executeQuery("SELECT * FROM player_data WHERE uuid='"+player_uuid+"'");
|
||||||
resultSet= queryResult.getResultSet();
|
resultSet= queryResult.getResultSet();
|
||||||
if(online) {
|
if(online && lastServer != JdbcConfig.SERVER_ID.get()) {
|
||||||
|
|
||||||
queryResult=JDBCsetUp.executeQuery("SELECT last_update,enable FROM server_info WHERE id='"+lastServer+"'");
|
queryResult=JDBCsetUp.executeQuery("SELECT last_update,enable FROM server_info WHERE id='"+lastServer+"'");
|
||||||
ResultSet getServerInfo = queryResult.getResultSet();
|
ResultSet getServerInfo = queryResult.getResultSet();
|
||||||
|
|
@ -275,15 +276,17 @@ public class VanillaSync {
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @SubscribeEvent
|
static int tick = 0;
|
||||||
// public void RegisterCommand(RegisterCommandsEvent event){
|
|
||||||
// CommandDispatcher<CommandSourceStack> dispatcher=event.getDispatcher();
|
@SubscribeEvent
|
||||||
// LiteralCommandNode<CommandSourceStack> cmd = dispatcher.register(
|
public static void onUpdate(Event event) throws SQLException {
|
||||||
// Commands.literal("serializeNBT").executes(context -> {context.getSource().sendSuccess(Component.literal(context.getSource().getPlayer().getItemInHand(InteractionHand.MAIN_HAND).serializeNBT().toString()),true);
|
tick++;
|
||||||
// return 0;
|
if(tick == 1200) {
|
||||||
// })
|
tick=0;
|
||||||
// );
|
long current = System.currentTimeMillis();
|
||||||
// }
|
JDBCsetUp.executeUpdate("UPDATE server_info SET last_update ="+current+" WHERE id= "+ JdbcConfig.SERVER_ID.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"playersync.already_online": "You cannot join more than one synchronization server at the same time."
|
"playersync.already_online": "You can't join more than one synchronization server at the same time."
|
||||||
}
|
}
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"playersync.already_online": "你不能同时加入一个以上的同步服务器。"
|
"playersync.already_online": "你不能同时加入多个同步的服务器。"
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user