Création d'un espace de travail fonctionnel
Bien que le plugin ait été désactivé en grande partie.
This commit is contained in:
parent
9a373f960e
commit
a63ee6d908
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,3 +2,6 @@
|
||||
.settings
|
||||
.project
|
||||
bin/
|
||||
/.gradle/
|
||||
/dependencies/
|
||||
/build/
|
||||
|
||||
56
build.gradle
Normal file
56
build.gradle
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* This generated file contains a sample Java Library project to get you started.
|
||||
* For more details take a look at the Java Libraries chapter in the Gradle
|
||||
* user guide available at https://docs.gradle.org/4.8.1/userguide/java_library_plugin.html
|
||||
*/
|
||||
|
||||
|
||||
|
||||
plugins {
|
||||
// Apply the java-library plugin to add support for Java Library
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
name 'm2-dv8tion'
|
||||
url 'https://m2.dv8tion.net/releases'
|
||||
}
|
||||
flatDir {
|
||||
dirs '../../Juliabot.git/build/libs'
|
||||
dirs '../Jul\'Anathème.git/build/libs'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task copyDependencies(type: Copy) {
|
||||
group 'build'
|
||||
from configurations.default
|
||||
into 'dependencies'
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation 'net.dv8tion:JDA:4.3.0_293'
|
||||
|
||||
implementation 'com.thedeanda:lorem:2.1'
|
||||
|
||||
implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.22'
|
||||
|
||||
implementation group: 'org.reflections', name: 'reflections', version: '0.9.11'
|
||||
|
||||
implementation name:'JuliabotAPI'
|
||||
//implementation name:'JuLSoundbox'
|
||||
|
||||
}
|
||||
10
settings.gradle
Normal file
10
settings.gradle
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* This file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
*
|
||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
||||
* in the user guide at https://docs.gradle.org/4.8.1/userguide/multi_project_builds.html
|
||||
*/
|
||||
|
||||
rootProject.name = "Jul'Anathème"
|
||||
@ -12,9 +12,11 @@ import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.reflections.Reflections;
|
||||
import org.reflections.scanners.SubTypesScanner;
|
||||
|
||||
import com.bernard.juliabot.api.Command;
|
||||
import com.bernard.juliabot.api.Discord;
|
||||
import com.bernard.juliabot.api.DiscordCCommande;
|
||||
import com.bernard.juliabot.api.JuLIAddon;
|
||||
import com.bernard.julianatheme.JuLIAnatheme.InvalidAnathemDescriptionException;
|
||||
|
||||
@ -28,7 +30,7 @@ import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.Event;
|
||||
|
||||
@JuLIAddon(name = "julianatheme",devs="Mysaa",version = "20w33a")
|
||||
public class JuliAnathèmeManager {
|
||||
public class JuliAnathemeManager {
|
||||
|
||||
|
||||
Map<Class<? extends JuLIAnatheme>,Set<JuLIAnatheme>> anathemes = new HashMap<>();
|
||||
@ -38,17 +40,16 @@ public class JuliAnathèmeManager {
|
||||
|
||||
public static final String anathemeNamePattern = "^[a-zA-Z0-9_-]*$";
|
||||
|
||||
static {
|
||||
//Load everybody
|
||||
Reflections r = new Reflections("");
|
||||
for (Class<? extends JuLIAnatheme> clazz : r.getSubTypesOf(JuLIAnatheme.class)) {
|
||||
public JuliAnathemeManager() {
|
||||
System.out.println("Instanciation du manager");
|
||||
try {
|
||||
registerAnatheme(clazz.getField("NAME").get(null).toString(), clazz);
|
||||
} catch (Exception e) {
|
||||
registerAnatheme(clazz.getSimpleName(), clazz);
|
||||
Class.forName("com.bernard.julianatheme.anathemes.StopTalkingAnatheme");
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.err.println("La classe n'a pas été trouvée.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//registerAnatheme(StopTalkingAnatheme.NAME, StopTalkingAnatheme.class);
|
||||
reloadAnathemes(); // La commande ne sert à rien
|
||||
}
|
||||
|
||||
@Discord(description="Lance les évents de toutes les malédictions chagées")
|
||||
@ -68,8 +69,34 @@ public class JuliAnathèmeManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void reloadAnathemes() {
|
||||
// La commande n'utilise en réalité pas les paramètres.
|
||||
reloadAnathemes(null);
|
||||
}
|
||||
|
||||
@Command(admin=true,name="reloadAnathemes",description="Recharge la liste des anathèmes")
|
||||
public void reloadAnathemes(DiscordCCommande commande) {
|
||||
// registeredAnathemes.clear();
|
||||
// registeredEvents.clear();
|
||||
// anathemes.clear();
|
||||
|
||||
Reflections r = new Reflections("",new SubTypesScanner(false));
|
||||
Set<Class<? extends JuLIAnatheme>> classes = r.getSubTypesOf(JuLIAnatheme.class);
|
||||
for (Class<? extends JuLIAnatheme> clazz : classes) {
|
||||
try {
|
||||
registerAnatheme(clazz.getField("NAME").get(null).toString(), clazz);
|
||||
} catch (Exception e) {
|
||||
registerAnatheme(clazz.getSimpleName(), clazz);
|
||||
}
|
||||
}
|
||||
System.out.println("Anathèmes enregistrés: "+registeredAnathemes.keySet());
|
||||
}
|
||||
|
||||
@Command(admin=true,name="maudir",description="Maudit une personne. Usage 'maudir <@pseudo> <type> <extra>")
|
||||
public void maudir(Message m,Guild g) {
|
||||
public void maudir(DiscordCCommande commande) {
|
||||
|
||||
Message m = commande.getMessage();
|
||||
Guild g = m.getGuild();
|
||||
|
||||
if(m.getMentionedUsers().size() < 1) {
|
||||
notifyUser("Il faut notifier l'utilisateur qu vous voulez maudir", m.getAuthor(), m.getChannel());
|
||||
@ -138,7 +165,10 @@ public class JuliAnathèmeManager {
|
||||
}
|
||||
|
||||
@Command(admin=true,name="oracle",description="Demande à l'oracle, quelles sont les maledictions planant sur une personne. Usage: 'oracle <@pseudo>")
|
||||
public void oracle(Message m,Guild g) {
|
||||
public void oracle(DiscordCCommande commande) {
|
||||
|
||||
Message m = commande.getMessage();
|
||||
Guild g = m.getGuild();
|
||||
|
||||
if(m.getMentionedUsers().size() < 1) {
|
||||
notifyUser("Il faut notifier l'utilisateur qu vous voulez 'oracler'", m.getAuthor(), m.getChannel());
|
||||
@ -171,8 +201,12 @@ public class JuliAnathèmeManager {
|
||||
m.getChannel().sendMessage(dumper.build()).complete();
|
||||
}
|
||||
|
||||
@Command(admin=true,name="exorciser",description="Excorcise une personne (lui enlève sa malediction). Usage 'exoriser <@pseudo> <type>")
|
||||
public void exorciser(Message m,Guild g) {
|
||||
@Command(admin=true,name="exorciser",description="Excorcise une personne (lui enlève sa malediction). Usage 'exorciser <@pseudo> <type>")
|
||||
public void exorciser(DiscordCCommande commande) {
|
||||
Message m = commande.getMessage();
|
||||
Guild g = m.getGuild();
|
||||
|
||||
|
||||
if(m.getMentionedUsers().size() < 1) {
|
||||
notifyUser("Il faut notifier l'utilisateur qu vous voulez exorciser", m.getAuthor(), m.getChannel());
|
||||
return;
|
||||
@ -208,6 +242,7 @@ public class JuliAnathèmeManager {
|
||||
notifyUser("Ohhhh "+cible.getNickname()+" a été purifié !!! Son anathème "+type+" a disparu !",m.getAuthor(), m.getChannel());
|
||||
}
|
||||
|
||||
|
||||
public static void registerAnatheme(String name, Class<? extends JuLIAnatheme> clazz) {
|
||||
System.out.println("Je vais registerer "+name);
|
||||
if(clazz == null) {
|
||||
@ -6,7 +6,6 @@ import java.io.IOException;
|
||||
|
||||
import com.bernard.julianatheme.EventReciever;
|
||||
import com.bernard.julianatheme.JuLIAnatheme;
|
||||
import com.bernard.julsoundbox.JulSoundBox;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
@ -35,7 +34,7 @@ public class HelloAnatheme extends JuLIAnatheme {
|
||||
@Override
|
||||
public void initialize(String extra, Guild g) throws InvalidAnathemDescriptionException {
|
||||
soundName = extra;
|
||||
if(JulSoundBox.checkUserSoundPermission(source.getUser(), extra))
|
||||
//if(JulSoundBox.checkUserSoundPermission(source.getUser(), extra))
|
||||
throw new InvalidAnathemDescriptionException("hello", "Le son "+extra+" n'est pas jouable (ou vous n'y avez pas accès) ... désolé");
|
||||
}
|
||||
|
||||
@ -46,7 +45,7 @@ public class HelloAnatheme extends JuLIAnatheme {
|
||||
|
||||
@EventReciever
|
||||
public void play(GuildVoiceJoinEvent event) {
|
||||
JulSoundBox.sneakPlay(soundName, event.getChannelJoined());
|
||||
//JulSoundBox.sneakPlay(soundName, event.getChannelJoined());
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,6 +8,7 @@ import java.util.List;
|
||||
|
||||
import com.bernard.julianatheme.EventReciever;
|
||||
import com.bernard.julianatheme.JuLIAnatheme;
|
||||
import com.bernard.julianatheme.JuliAnathemeManager;
|
||||
|
||||
import net.dv8tion.jda.api.MessageBuilder;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
@ -19,6 +20,10 @@ public class StopTalkingAnatheme extends JuLIAnatheme {
|
||||
|
||||
public static final String NAME = "stopTalking";
|
||||
|
||||
static {
|
||||
JuliAnathemeManager.registerAnatheme(NAME, StopTalkingAnatheme.class);
|
||||
}
|
||||
|
||||
long[] channelsIDs;
|
||||
|
||||
|
||||
@ -64,7 +69,7 @@ public class StopTalkingAnatheme extends JuLIAnatheme {
|
||||
|
||||
@Override
|
||||
public String dump() {
|
||||
return "Sur les caneaux " + Arrays.toString(channelsIDs);
|
||||
return "Sur les canaux " + Arrays.toString(channelsIDs);
|
||||
}
|
||||
|
||||
@EventReciever
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user