#Clear pet level or rollback
1 messages · Page 1 of 1 (latest)
Hi 👋 this issue has not been reported in a while. What version of MCPets are you running? Do you use DB support or plain YAML?
MARIABD , mcpets 4.1.5
Do you know ways of reproducing the issue?
No, but it happens often for my players after having disconnect/reconnect for a long time, I would say.
mh
I think I know, basically it saves only connected players and not all players in the plugin's memory at that time, which can cause the loss of saves
?
Hi 👋 sorry for the long absence, I was at a conference for the whole week.
Thanks for pointing out a possible issue. I double checked the code and it is not saving only connected players. Can you send your DB parameters (avoid sharing sensible information)
I use MySql
DisableMySQL: false
Db parameter? Like timeout delay?
Yes precisely those options
In the config there're options for saving delay as well
DefaultName: §9Pet of %player%
OverrideDefaultName: true
EnableClickBackToMenu: true
UseDefaultMythicMobsNames: false
RightClickToOpenMenu: false
LeftClickToOpenMenu: false
DisableInventoryWhileHoldingSignalStick: true
DismountOnDamaged: true
SpawnPetOnReconnect: true
SneakMode: false
Nameable: true
Mountable: true
DistanceTeleport: 30
MaxNameLenght: 16
InventorySize: -1
PercentHealthOnRespawn: 0.2
ActivateBackMenuIcon: true
AutoSaveDelay: 3600
GlobalRespawnCooldown: false
DefaultRespawnCooldown: 0
AutoRespawn: true
Experience:
BarSize: 40
Symbol: '|'
ColorDone: §a
ColorLeft: §f
Taming:
AnnouncementType: CHAT
BarSize: 40
Symbol: '|'
ColorDone: §a
ColorLeft: §f
MySQL:
Prefix: mcpets_
User: xxx
Password: xxx
Host: xxx
Port: 'xxx'
Database: xxx
BlackListedWorlds: []
DisableMySQL: false
DismountOnDamagedExcludePlayers: false
FastMount: false
DisableFastMountWhileHoldingSignalStick: false
I don't know precisely how multi server works, but I guess the MCPets plugin is installed on all of them right?
I see a 3600 yup
I'll grab a bite and come back to you real quick
I have the impression that when I restart the main server, the players who had updated their pets during this time online are rolled back, as if the plugin saves some sort of obsolete cache on the DB
and often when I let the server run for a long time like +8 hours I would say, because if I restart 10-15 min later there will be no rollback
There's indeed something of that kind
Since all servers run a different instance of MCPets
There needs to be only one that saves the DB on a regular basis
Currently I only have 1 mcpets server on my db.
It's been a while since I last discussed this tbh so I would need to research the discord or maybe it's on the wiki somewhere
What do you mean by this?
I use mariaDB, but i have only one server for the moment
You mean you have 1 database, that's what you mean right?
That is perfectly fine if so
What I meant was
All of your Minecraft servers run MCPets
Rather 1 server, connected to 1 database and not yet several servers to the same database
no
hm
wait
my dev server
I think that must be the reason, because it restarts quite often.
They're both connected to the same database?
yes
Generally speaking, if multiple servers are connected to the same database, only one needs to perform the save cycle, otherwise the cache is overwritten between both servers and it bugs. So for the main server where people use their pets, you should have a saving cycle that runs with the AutoSaveDelay set to like 3600. For the other servers you should set -1
and if i have multiple main server ?
or i can disable autoSaveDelay in all server and save only with restart ?
I think it works yeah, but I think you can have the lobby running the save only too
It doesn't have to be the server where people use their pets I believe
Although it's been years since I made this feature so I kinda forget as time goes on 😅
Same problem, my pet player is rollback :c
This morning
The saveData() method used TRUNCATE followed by INSERT, creating a window where data could be lost if two servers were saved
@main juniper i think is a problem
getMySQL().query("REPLACE INTO " + table + " (uuid, names, inventories, data) VALUES (...)");
use this
// Old (unsafe)
getMySQL().query("TRUNCATE " + table);
// New (safe)
getMySQL().query("REPLACE INTO " + table + " (uuid, names, inventories, data) VALUES (...)");
I think someone has made a recent change in this through a PR
Are you using latest build? Maybe this has already been looked into
Yes 4.1.6