Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 6153d38

Browse files
author
CodeDoctorDE
committed
adding template and rename global to team
1 parent 64c15f0 commit 6153d38

File tree

11 files changed

+218
-50
lines changed

11 files changed

+218
-50
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.github.codedoctorde.linwood.commands;
2+
3+
import com.github.codedoctorde.linwood.entity.GuildEntity;
4+
import net.dv8tion.jda.api.entities.Message;
5+
import org.hibernate.Session;
6+
import org.jetbrains.annotations.NotNull;
7+
8+
import java.util.Arrays;
9+
import java.util.HashSet;
10+
import java.util.ResourceBundle;
11+
import java.util.Set;
12+
13+
/**
14+
* @author CodeDoctorDE
15+
*/
16+
public class WriteCommand implements Command {
17+
@Override
18+
public boolean onCommand(Session session, Message message, GuildEntity entity, String label, String[] args) {
19+
return false;
20+
}
21+
22+
@Override
23+
public @NotNull Set<String> aliases(GuildEntity entity) {
24+
return new HashSet<>(Arrays.asList(
25+
"write",
26+
"w"
27+
));
28+
}
29+
30+
@Override
31+
public @NotNull ResourceBundle getBundle(GuildEntity entity) {
32+
return ResourceBundle.getBundle("locale.commands.Write", entity.getLocalization());
33+
}
34+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.github.codedoctorde.linwood.commands.settings.template;
2+
3+
import com.github.codedoctorde.linwood.commands.Command;
4+
import com.github.codedoctorde.linwood.entity.GuildEntity;
5+
import net.dv8tion.jda.api.entities.Message;
6+
import org.hibernate.Session;
7+
import org.jetbrains.annotations.NotNull;
8+
9+
import java.util.ResourceBundle;
10+
import java.util.Set;
11+
12+
/**
13+
* @author CodeDoctorDE
14+
*/
15+
public class CreateTemplateCommand implements Command {
16+
@Override
17+
public boolean onCommand(Session session, Message message, GuildEntity entity, String label, String[] args) {
18+
return false;
19+
}
20+
21+
@Override
22+
public @NotNull Set<String> aliases(GuildEntity entity) {
23+
return null;
24+
}
25+
26+
@Override
27+
public @NotNull ResourceBundle getBundle(GuildEntity entity) {
28+
return null;
29+
}
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.github.codedoctorde.linwood.commands.settings.template;
2+
3+
import com.github.codedoctorde.linwood.commands.Command;
4+
import com.github.codedoctorde.linwood.entity.GuildEntity;
5+
import net.dv8tion.jda.api.entities.Message;
6+
import org.hibernate.Session;
7+
import org.jetbrains.annotations.NotNull;
8+
9+
import java.util.ResourceBundle;
10+
import java.util.Set;
11+
12+
/**
13+
* @author CodeDoctorDE
14+
*/
15+
public class ListTemplateCommand implements Command {
16+
@Override
17+
public boolean onCommand(Session session, Message message, GuildEntity entity, String label, String[] args) {
18+
return false;
19+
}
20+
21+
@Override
22+
public @NotNull Set<String> aliases(GuildEntity entity) {
23+
return null;
24+
}
25+
26+
@Override
27+
public @NotNull ResourceBundle getBundle(GuildEntity entity) {
28+
return null;
29+
}
30+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.github.codedoctorde.linwood.commands.settings.template;
2+
3+
import com.github.codedoctorde.linwood.commands.Command;
4+
import com.github.codedoctorde.linwood.entity.GuildEntity;
5+
import net.dv8tion.jda.api.entities.Message;
6+
import org.hibernate.Session;
7+
import org.jetbrains.annotations.NotNull;
8+
9+
import java.util.ResourceBundle;
10+
import java.util.Set;
11+
12+
/**
13+
* @author CodeDoctorDE
14+
*/
15+
public class RemoveTemplateCommand implements Command {
16+
@Override
17+
public boolean onCommand(Session session, Message message, GuildEntity entity, String label, String[] args) {
18+
return false;
19+
}
20+
21+
@Override
22+
public @NotNull Set<String> aliases(GuildEntity entity) {
23+
return null;
24+
}
25+
26+
@Override
27+
public @NotNull ResourceBundle getBundle(GuildEntity entity) {
28+
return null;
29+
}
30+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.github.codedoctorde.linwood.commands.settings.template;
2+
3+
import com.github.codedoctorde.linwood.commands.Command;
4+
import com.github.codedoctorde.linwood.commands.CommandManager;
5+
import com.github.codedoctorde.linwood.entity.GuildEntity;
6+
import org.jetbrains.annotations.NotNull;
7+
8+
import java.util.ResourceBundle;
9+
import java.util.Set;
10+
11+
/**
12+
* @author CodeDoctorDE
13+
*/
14+
public class TemplateCommand extends CommandManager {
15+
@Override
16+
public @NotNull Command[] commands() {
17+
return new Command[]{
18+
new CreateTemplateCommand(),
19+
new ListTemplateCommand(),
20+
new RemoveTemplateCommand()
21+
};
22+
}
23+
24+
@Override
25+
public @NotNull Set<String> aliases(GuildEntity entity) {
26+
return null;
27+
}
28+
29+
@Override
30+
public @NotNull ResourceBundle getBundle(GuildEntity entity) {
31+
return null;
32+
}
33+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.github.codedoctorde.linwood.entity;
2+
3+
import javax.persistence.*;
4+
5+
/**
6+
* @author CodeDoctorDE
7+
*/
8+
@Entity
9+
@Table
10+
public class DeleteChannelEntity {
11+
@Id
12+
@GeneratedValue(strategy = GenerationType.AUTO)
13+
@Column(name = "id")
14+
private Long id;
15+
private long channelId;
16+
}

src/main/java/com/github/codedoctorde/linwood/entity/GlobalEntity.java

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/main/java/com/github/codedoctorde/linwood/entity/NotificationEntity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import net.dv8tion.jda.api.entities.TextChannel;
88

99
import javax.persistence.*;
10+
import java.util.ArrayList;
11+
import java.util.List;
1012

1113
@Entity
1214
@Table(name = "notification")
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.github.codedoctorde.linwood.entity;
2+
3+
import javax.persistence.*;
4+
import java.util.ArrayList;
5+
import java.util.Arrays;
6+
import java.util.List;
7+
8+
@Entity
9+
public class TeamEntity {
10+
@Id
11+
@GeneratedValue(strategy = GenerationType.AUTO)
12+
@Column(name = "id")
13+
private Long id;
14+
@OneToMany
15+
private final List<TeamMemberEntity> guilds = new ArrayList<>();
16+
17+
public TeamEntity(){}
18+
public TeamEntity(GuildEntity ownerGuild, GuildEntity... memberGuilds){
19+
guilds.add(new TeamMemberEntity(ownerGuild, PermissionLevel.OWNER));
20+
Arrays.stream(memberGuilds).forEach(guild -> guilds.add(new TeamMemberEntity(guild, PermissionLevel.MEMBER)));
21+
}
22+
23+
public List<TeamMemberEntity> getGuilds() {
24+
return guilds;
25+
}
26+
27+
public Long getId() {
28+
return id;
29+
}
30+
}

src/main/java/com/github/codedoctorde/linwood/entity/GlobalGuildEntity.java renamed to src/main/java/com/github/codedoctorde/linwood/entity/TeamMemberEntity.java

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55
import java.util.List;
66

77
@Entity
8-
public class GlobalGuildEntity {
8+
public class TeamMemberEntity {
99
@Id
1010
@GeneratedValue(strategy = GenerationType.AUTO)
1111
@Column(name = "id")
1212
private Long id;
13-
private final long guildId;
13+
@OneToOne
14+
private GuildEntity guild;
1415
private PermissionLevel permissionLevel;
15-
private Long globalChat;
16-
private final List<Long> syncRolesId = new ArrayList<>();
1716

18-
public GlobalGuildEntity(Long guildId, PermissionLevel level){
17+
public TeamMemberEntity(GuildEntity guild, PermissionLevel level){
1918
permissionLevel = level;
20-
this.guildId = guildId;
19+
this.guild = guild;
20+
}
21+
22+
public TeamMemberEntity() {
23+
2124
}
2225

2326
public PermissionLevel getPermissionLevel() {
@@ -32,19 +35,7 @@ public Long getId() {
3235
return id;
3336
}
3437

35-
public long getGuildId() {
36-
return guildId;
37-
}
38-
39-
public List<Long> getSyncRolesId() {
40-
return syncRolesId;
41-
}
42-
43-
public Long getGlobalChat() {
44-
return globalChat;
45-
}
46-
47-
public void setGlobalChat(Long globalChat) {
48-
this.globalChat = globalChat;
38+
public GuildEntity getGuild() {
39+
return guild;
4940
}
5041
}

0 commit comments

Comments
 (0)