Removed Ridecount
This commit is contained in:
parent
184d8c59cb
commit
7c7fbbdfa6
3 changed files with 6 additions and 47 deletions
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -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 + " regionlore [id] [index] [lore]"));
|
||||||
sender.sendMessage(Utils.color("&f/" + name + " setlocation [id]"));
|
sender.sendMessage(Utils.color("&f/" + name + " setlocation [id]"));
|
||||||
sender.sendMessage(Utils.color("&f/" + name + " attraction [id] [status]"));
|
sender.sendMessage(Utils.color("&f/" + name + " attraction [id] [status]"));
|
||||||
sender.sendMessage(Utils.color("&f/" + name + " ridecount [id] [player]"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -329,36 +328,6 @@ public class ThemeParkCommand extends BukkitCommand {
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 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 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 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 attraction", null);
|
||||||
database.execute("TRUNCATE TABLE region", null);
|
database.execute("TRUNCATE TABLE region", null);
|
||||||
|
@ -95,21 +94,6 @@ public class DatabaseHandler {
|
||||||
database.execute("DELETE FROM region WHERE id=?", objects);
|
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<Integer, Object> 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() {
|
public void disconnect() {
|
||||||
database.disconnect();
|
database.disconnect();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue