aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/brysonsteck/PlayerAttributes.java24
-rw-r--r--src/net/brysonsteck/PlayerData.java46
-rw-r--r--src/net/brysonsteck/Resurrection.java44
-rw-r--r--src/net/brysonsteck/plugin.yml0
4 files changed, 114 insertions, 0 deletions
diff --git a/src/net/brysonsteck/PlayerAttributes.java b/src/net/brysonsteck/PlayerAttributes.java
new file mode 100644
index 0000000..de8edcc
--- /dev/null
+++ b/src/net/brysonsteck/PlayerAttributes.java
@@ -0,0 +1,24 @@
+package net.brysonsteck;
+
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.plugin.Plugin;
+
+public class PlayerAttributes implements Listener {
+ public Plugin plugin = Resurrection.getPlugin(Resurrection.class);
+
+ public void onDeath(PlayerDeathEvent event) {
+ Player p = event.getEntity();
+ Player k = event.getEntity().getKiller();
+ int killcount = plugin.getConfig().getInt("Users." + k.getUniqueId().toString() + ".Kills") ;
+ int deathcount = plugin.getConfig().getInt("Users." + p.getUniqueId().toString() + ".Deaths") ;
+
+ plugin.getConfig().set("Users." + p.getUniqueId().toString() + ".Deaths", deathcount + 1);
+ plugin.getConfig().set("Users." + k.getUniqueId().toString() + ".Kills", killcount + 1);
+ plugin.saveConfig();
+
+
+ }
+} \ No newline at end of file
diff --git a/src/net/brysonsteck/PlayerData.java b/src/net/brysonsteck/PlayerData.java
new file mode 100644
index 0000000..556c147
--- /dev/null
+++ b/src/net/brysonsteck/PlayerData.java
@@ -0,0 +1,46 @@
+package net.brysonsteck;
+
+import java.io.*;
+import java.util.Arrays;
+import java.util.Hashtable;
+
+public class PlayerData {
+ Hashtable<String, Hashtable<String, String>> playerData = new Hashtable<>();
+
+ public void saveData(String write) {
+ try {
+ FileWriter writer = new FileWriter("data/player.data");
+ writer.write(write);
+ writer.close();
+ readData();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void readData() {
+ try {
+ BufferedReader reader = new BufferedReader(new FileReader("data/player.data"));
+ String line = "";
+ String[] playerData;
+ while (true) {
+ playerData = new String[3];
+ line = reader.readLine();
+ if (line == null) {
+ break;
+ }
+ playerData = line.split(",");
+ Hashtable<String, String> playerHash = new Hashtable<>();
+ playerHash.put("dead", playerData[1]);
+ playerHash.put("timeLeft", playerData[2]);
+ this.playerData.put(playerData[0], playerHash);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public Hashtable<String, Hashtable<String, String>> getPlayers() {
+ return playerData;
+ }
+}
diff --git a/src/net/brysonsteck/Resurrection.java b/src/net/brysonsteck/Resurrection.java
new file mode 100644
index 0000000..c4553e8
--- /dev/null
+++ b/src/net/brysonsteck/Resurrection.java
@@ -0,0 +1,44 @@
+package net.brysonsteck;
+
+import org.bukkit.event.player.PlayerRespawnEvent;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.io.*;
+import java.nio.Buffer;
+
+public class Resurrection extends JavaPlugin {
+ public Plugin plugin = getPlugin(Resurrection.class);
+
+ //spigot things
+ @Override
+ public void onDisable() {
+ super.onDisable();
+ }
+
+ @Override
+ public void onEnable() {
+ super.onEnable();
+
+ }
+
+ // end of spigot things
+ public static void main(String[] args) {
+// PlayerData playerData = new PlayerData();
+// playerData.saveData("This is the first line\nthis is the second line");
+// System.out.println(playerData.getPlayers());
+// playerData.readData();
+
+// playerData.saveData("username,false,0");
+// System.out.println("now adding two more lines");
+// playerData.saveData(playerData.getPlayers() + "this is the third line\nthis is the fourth line\nthe thread is now sleeping\nonce more\nand again");
+// System.out.println(playerData.getPlayers());
+// try {
+// Thread.sleep(100000);
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+
+ }
+
+}
diff --git a/src/net/brysonsteck/plugin.yml b/src/net/brysonsteck/plugin.yml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/net/brysonsteck/plugin.yml