From 7c7fbbdfa633ae792fe26e727a716c236b833669 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 15 Jan 2019 18:31:26 +0100 Subject: [PATCH] Removed Ridecount --- .idea/vcs.xml | 6 ++++ .../themepark/command/ThemeParkCommand.java | 31 ------------------- .../themepark/database/DatabaseHandler.java | 16 ---------- 3 files changed, 6 insertions(+), 47 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/me/paradoxpixel/themepark/command/ThemeParkCommand.java b/src/main/java/me/paradoxpixel/themepark/command/ThemeParkCommand.java index 628004d..4b17939 100644 --- a/src/main/java/me/paradoxpixel/themepark/command/ThemeParkCommand.java +++ b/src/main/java/me/paradoxpixel/themepark/command/ThemeParkCommand.java @@ -47,7 +47,6 @@ public class ThemeParkCommand extends BukkitCommand { sender.sendMessage(Utils.color("&f/" + name + " regionlore [id] [index] [lore]")); sender.sendMessage(Utils.color("&f/" + name + " setlocation [id]")); sender.sendMessage(Utils.color("&f/" + name + " attraction [id] [status]")); - sender.sendMessage(Utils.color("&f/" + name + " ridecount [id] [player]")); } return true; @@ -329,36 +328,6 @@ public class ThemeParkCommand extends BukkitCommand { return true; } - if (args[0].equalsIgnoreCase("ridecount")) { - if (args.length < 3) { - sender.sendMessage(Utils.color("&6Themepark&f: &4/" + name + " ridecount [id] [player]")); - return true; - } - - String id = args[1]; - if (!API.isAttraction(id)) { - String message = Message.getMessage("attraction.no"); - message = message.replace("{id}", id); - sender.sendMessage(Utils.color(message)); - return true; - } - - Attraction attraction = API.getAttraction(id); - String string = args[2]; - if(Bukkit.getPlayerExact(string) == null) { - String message = Message.getMessage("noplayer"); - message = message.replace("{name}", string); - sender.sendMessage(Utils.color(message)); - return true; - } - - Player player = Bukkit.getPlayerExact(string); - - ThemeParkPlugin.getInstance().getDatabaseHandler().addCount(player.getUniqueId(), attraction); - //TODO MESSAGE - return true; - } - return false; } diff --git a/src/main/java/me/paradoxpixel/themepark/database/DatabaseHandler.java b/src/main/java/me/paradoxpixel/themepark/database/DatabaseHandler.java index b6a9f8f..708e5cf 100644 --- a/src/main/java/me/paradoxpixel/themepark/database/DatabaseHandler.java +++ b/src/main/java/me/paradoxpixel/themepark/database/DatabaseHandler.java @@ -25,7 +25,6 @@ public class DatabaseHandler { database.execute("CREATE TABLE IF NOT EXISTS attraction (id VARCHAR(256) NOT NULL, name VARCHAR(256) NOT NULL, region_id VARCHAR(256) NOT NULL, type VARCHAR(256) NOT NULL, status VARCHAR(256) NOT NULL, PRIMARY KEY(id))", null); database.execute("CREATE TABLE IF NOT EXISTS region (id VARCHAR(256) NOT NULL, name VARCHAR(256) NOT NULL, PRIMARY KEY(id))", null); database.execute("CREATE TABLE IF NOT EXISTS status (statusId VARCHAR(256) NOT NULL, statusName VARCHAR(256) NOT NULL)", null); - database.execute("CREATE TABLE IF NOT EXISTS ridecount (uuid VARCHAR(256) NOT NULL, attractionId VARCHAR(256) NOT NULL, date VARCHAR(256), count INT(11) NOT NULL)", null); database.execute("TRUNCATE TABLE attraction", null); database.execute("TRUNCATE TABLE region", null); @@ -95,21 +94,6 @@ public class DatabaseHandler { database.execute("DELETE FROM region WHERE id=?", objects); } - public void addCount(UUID uuid, Attraction attraction) { - String pattern = "dd-MM-yyyy"; - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); - String date = simpleDateFormat.format(new Date()); - - HashMap objects = new HashMap<>(); - objects.put(1, uuid.toString()); - objects.put(2, attraction.getId()); - objects.put(3, date); - - if(database.executeUpdate("UPDATE ridecount SET count=count+1 WHERE uuid=? AND attractionId=? AND date=?", objects) < 1) { - database.execute("INSERT INTO ridecount(uuid,attractionId,date,count) VALUES (?,?,?,1)", objects); - } - } - public void disconnect() { database.disconnect(); }