Skip to content

Commit

Permalink
спасибо дарку
Browse files Browse the repository at this point in the history
  • Loading branch information
NazrinNya committed Jul 5, 2023
1 parent f64698e commit 8c6abf6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 1 addition & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,12 @@ dependencies {
compileOnly "com.github.Anuken.Arc:arc-core:$mindustryVersion"
compileOnly "com.github.Anuken.Mindustry:core:$mindustryVersion"
compileOnly "com.github.Anuken.Mindustry:server:$mindustryVersion"
implementation "com.github.xzxadixzx.useful-stuffs:bundle:3c4241ca6d"
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
implementation "org.javacord:javacord:3.8.0"
implementation "org.mongodb:mongodb-driver-sync:4.10.1"
implementation "org.mongodb:mongodb-driver-core:4.10.1"
implementation "org.mongodb:bson:4.10.1"
//implementation 'org.mariadb.jdbc:mariadb-java-client:3.1.2'
//implementation 'com.theokanning.openai-gpt3-java:service:0.11.1'
//implementation 'org.springframework.boot:spring-boot-starter-web'
//implementation "org.xerial:sqlite-jdbc:3.39.4.1"
//implementation "com.j256.ormlite:ormlite-jdbc:6.1"
}

jar {
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/plugin/Ploogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
import plugin.discord.Bot;
import plugin.ConfigJson;
import plugin.utils.Utilities;
import useful.Bundle;


import java.io.IOException;
import java.util.Date;
import java.util.Locale;
import java.util.Map;

import static com.mongodb.client.model.Filters.eq;
Expand Down Expand Up @@ -64,6 +66,7 @@ public void MongoDbPlayerCreation(Player eventPlayer){
// starts once plugin is started
public void init() {
Log.info("Plugin started!");
Bundle.defaultLocale = new Locale("en");
Events.on(EventType.PlayerJoin.class, event ->
MongoDbPlayerCreation(event.player)
);
Expand All @@ -72,8 +75,8 @@ public void init() {
long lastBan = user.getLong("lastBan");
Date date = new Date();
if (lastBan > date.getTime()) {
long timeUntilUnban = (lastBan - date.getTime())/1000;
event.player.con.kick("You have been banned! Wait " + timeUntilUnban + " more seconds for unban!", 0);
String timeUntilUnban = Bundle.formatDate(lastBan - date.getTime());
event.player.con.kick("You have been banned! Wait " + timeUntilUnban + " more for unban!", 0);
}
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/plugin/utils/MenuHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.javacord.api.entity.message.embed.EmbedBuilder;
import plugin.Ploogin;
import plugin.discord.Bot;
import useful.Bundle;

import java.util.Date;

Expand All @@ -26,13 +27,12 @@ public class MenuHandler {
return;
}
case 0 -> {
Document usr = Ploogin.playerCollection.find(Filters.eq("uuid", plr.uuid())).first();
Date date = new Date();
long banTime = date.getTime() + Ploogin.time*1000;
/*Vars.netServer.admins.banPlayerIP(plr.ip());
Vars.netServer.admins.banPlayer(plr.uuid());*/
plr.con.kick("You have been banned for: " + Ploogin.reason);
long banTime = date.getTime() + Ploogin.time*86400000;
String timeUntilUnban = Bundle.formatDate(Ploogin.time*86400000);
plr.con.kick("You have been banned for: " + Ploogin.reason + ". Wait " + timeUntilUnban + " until unban!", 0);
Call.sendMessage(plr.plainName() + " has been banned for: " + Ploogin.reason);
Document usr = Ploogin.playerCollection.find(Filters.eq("uuid", plr.uuid())).first();
Bson updates = Updates.combine(
Updates.set("lastBan", banTime)
);
Expand Down

0 comments on commit 8c6abf6

Please sign in to comment.