Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.jacob.spigot.plugins.SuperReports;
- import com.google.common.collect.ImmutableMap;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.serialization.ConfigurationSerializable;
- import org.bukkit.entity.Player;
- import java.util.Map;
- public class Report implements ConfigurationSerializable {
- FileConfiguration data = SuperReports.getInstance().getPlayerData();
- private int id;
- private int targetid;
- private Player target;
- private Player reporter;
- private String reason;
- public Report(int id, int targetid, Player target, Player reporter, String reason) {
- this.id = id;
- this.target = target;
- this.reporter = reporter;
- this.reason = reason;
- }
- public Map<String, Object> serialize() {
- return ImmutableMap.of("id", id, "targetid", targetid, "target", target, "reporter", reporter, "reason", reason );
- }
- public static Report deserialize(Map<String, Object> map) {
- return new Report((int)map.get("id"), (int)map.get("targetid"), (int)map.get("target"), (int)map.get("reporter"), (int)map.get("reason"));
- }
- public void saveToData() {
- data.set("reports." + String.valueOf(id) + ".target", target.getName());
- data.set("reports." + String.valueOf(id) + ".reporter", reporter.getName());
- data.set("reports." + String.valueOf(id) + ".reason", reason);
- SuperReports.getInstance().savePlayerData();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement