Add column SQL

This commit is contained in:
Ka0rX 2022-07-04 13:21:55 +02:00
parent 7585ba243b
commit 12e8146d34
4 changed files with 20 additions and 3 deletions

View File

@ -79,8 +79,7 @@ public class AttributeView extends EditableInventory {
StatInfo info = StatInfo.valueOf(buff.getStat()); StatInfo info = StatInfo.valueOf(buff.getStat());
holders.register("buff_" + buff.getStat().toLowerCase(), info.format(buff.getValue())); holders.register("buff_" + buff.getStat().toLowerCase(), info.format(buff.getValue()));
holders.register("total_" + buff.getStat().toLowerCase(), info.format(buff.multiply(total).getValue())); holders.register("total_" + buff.getStat().toLowerCase(), info.format(buff.multiply(total).getValue()));
Bukkit.broadcastMessage(info.format(0.34));
Bukkit.broadcastMessage((new DecimalFormat(null)==null)+"");
}); });
return holders; return holders;

View File

@ -18,6 +18,7 @@ import net.Indyuce.mmocore.experience.Booster;
import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmocore.party.AbstractParty; import net.Indyuce.mmocore.party.AbstractParty;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -222,6 +223,7 @@ public class PlayerStats extends EditableInventory {
ItemStack disp = super.display(inv, n); ItemStack disp = super.display(inv, n);
if (disp.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) { if (disp.getType() == VersionMaterial.PLAYER_HEAD.toMaterial()) {
SkullMeta meta = (SkullMeta) disp.getItemMeta(); SkullMeta meta = (SkullMeta) disp.getItemMeta();
inv.dynamicallyUpdateItem(this, n, disp, current -> { inv.dynamicallyUpdateItem(this, n, disp, current -> {
meta.setOwningPlayer(inv.getPlayer()); meta.setOwningPlayer(inv.getPlayer());
current.setItemMeta(meta); current.setItemMeta(meta);

View File

@ -7,6 +7,9 @@ import net.Indyuce.mmocore.manager.data.PlayerDataManager;
import net.Indyuce.mmocore.manager.data.yaml.YAMLGuildDataManager; 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.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);
private final YAMLGuildDataManager guildManager = new YAMLGuildDataManager(); private final YAMLGuildDataManager guildManager = new YAMLGuildDataManager();
@ -42,7 +45,19 @@ getResultAsync("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '"
+ "experience INT(11) DEFAULT 0,class VARCHAR(20),guild VARCHAR(20),last_login LONG," + "experience INT(11) DEFAULT 0,class VARCHAR(20),guild VARCHAR(20),last_login LONG,"
+ "attributes LONGTEXT,professions LONGTEXT,times_claimed LONGTEXT,quests LONGTEXT," + "attributes LONGTEXT,professions LONGTEXT,times_claimed LONGTEXT,quests LONGTEXT,"
+ "waypoints LONGTEXT,friends LONGTEXT,skills LONGTEXT,bound_skills LONGTEXT," + "waypoints LONGTEXT,friends LONGTEXT,skills LONGTEXT,bound_skills LONGTEXT,"
+ "class_info LONGTEXT,is_saved INT(1), PRIMARY KEY (uuid));"); + "class_info LONGTEXT, PRIMARY KEY (uuid));");//TODO
getResult("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = 'mmocore_playerdata'" +
" AND COLUMN_NAME = 'is_saved'",(result)-> {
try {
if(!result.next())
executeUpdate("ALTER TABLE mmocore_playerdata ADD is_saved TINYINT");
} catch (SQLException e) {
throw new RuntimeException(e);
}
});
} }
@Override @Override

View File

@ -160,6 +160,7 @@ public class Party implements AbstractParty {
Request request = new PartyInvite(this, inviter, target); Request request = new PartyInvite(this, inviter, target);
new ConfigMessage("party-invite").addPlaceholders("player", inviter.getPlayer().getName(), "uuid", request.getUniqueId().toString()) new ConfigMessage("party-invite").addPlaceholders("player", inviter.getPlayer().getName(), "uuid", request.getUniqueId().toString())
.sendAsJSon(target.getPlayer()); .sendAsJSon(target.getPlayer());
MMOCore.plugin.requestManager.registerRequest(request); MMOCore.plugin.requestManager.registerRequest(request);
} }