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

Commit 41d9cb6

Browse files
committed
Merge branch 'release/0.1.4'
2 parents d41072a + be41b51 commit 41d9cb6

16 files changed

Lines changed: 1605 additions & 70 deletions

LICENSE

Lines changed: 674 additions & 21 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Partie BungeeCord qui sera utilisée par le Bungee pour le projet Froxy-Network
44
Ce dépôt contient les sources et la documentation pour la partie FroxyBungee.
55

66
## Librairies
7-
- [slf4j](https://www.slf4j.org/)
8-
- [lombok](https://github.com/rzwitserloot/lombok)
9-
- [FroxyNetwork](https://github.com/froxynetwork/froxynetwork)
10-
- [FroxyGame](https://github.com/froxynetwork/froxygame)
7+
- [slf4j](https://www.slf4j.org/)
8+
- [lombok](https://github.com/rzwitserloot/lombok)
9+
- [FroxyNetwork](https://github.com/froxynetwork/froxynetwork)
10+
- [FroxyGame](https://github.com/froxynetwork/froxygame)
1111

1212
## License
1313
This software is available under the following licenses:
1414

15-
* MIT
15+
- GNU General Public License

pom.xml

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
45

5-
<groupId>com.froxynetwork</groupId>
6-
<artifactId>FroxyBungee</artifactId>
7-
<version>0.0.1</version>
8-
<packaging>jar</packaging>
6+
<groupId>com.froxynetwork</groupId>
7+
<artifactId>FroxyBungee</artifactId>
8+
<version>0.1.4</version>
9+
<packaging>jar</packaging>
910

10-
<name>FroxyBungee</name>
11-
<url>https://github.com/FroxyNetwork/FroxyBungee</url>
11+
<name>FroxyBungee</name>
12+
<url>https://github.com/FroxyNetwork/FroxyBungee</url>
1213

13-
<properties>
14-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15-
<maven.compiler.source>1.8</maven.compiler.source>
16-
<maven.compiler.target>1.8</maven.compiler.target>
17-
</properties>
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<maven.compiler.source>1.8</maven.compiler.source>
17+
<maven.compiler.target>1.8</maven.compiler.target>
18+
</properties>
1819
<developers>
1920
<developer>
2021
<name>0ddlyoko</name>
@@ -28,8 +29,8 @@
2829
<!-- Configuration of repositories -->
2930
<repositories>
3031
<repository>
31-
<id>spigot-repo</id>
32-
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
32+
<id>bungeecord-repo</id>
33+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
3334
</repository>
3435

3536
<repository>
@@ -86,19 +87,47 @@
8687
</plugins>
8788
</build>
8889
<dependencies>
90+
<!-- Logging -->
91+
<dependency>
92+
<groupId>org.slf4j</groupId>
93+
<artifactId>slf4j-api</artifactId>
94+
<version>1.7.26</version>
95+
</dependency>
96+
<dependency>
97+
<groupId>org.slf4j</groupId>
98+
<artifactId>slf4j-log4j12</artifactId>
99+
<version>1.7.6</version>
100+
</dependency>
101+
102+
<!-- Lombok -->
103+
<dependency>
104+
<groupId>org.projectlombok</groupId>
105+
<artifactId>lombok</artifactId>
106+
<version>1.18.6</version>
107+
<scope>provided</scope>
108+
</dependency>
89109

90110
<!-- Network -->
91111
<dependency>
92-
<groupId>com.github.froxynetwork</groupId>
93-
<artifactId>froxynetwork</artifactId>
94-
<version>0.1.3</version>
112+
<groupId>com.froxynetwork</groupId>
113+
<artifactId>FroxyNetwork</artifactId>
114+
<version>0.1.4</version>
95115
</dependency>
96116

97117
<!-- Game -->
98118
<dependency>
99-
<groupId>com.github.froxynetwork</groupId>
100-
<artifactId>froxygame</artifactId>
101-
<version>0.0.3</version>
119+
<groupId>com.froxynetwork</groupId>
120+
<artifactId>FroxyGame</artifactId>
121+
<version>0.1.4</version>
122+
</dependency>
123+
124+
<!-- BungeeCord -->
125+
<dependency>
126+
<groupId>net.md-5</groupId>
127+
<artifactId>bungeecord-api</artifactId>
128+
<version>1.14-SNAPSHOT</version>
129+
<type>jar</type>
130+
<scope>provided</scope>
102131
</dependency>
103132
</dependencies>
104133
</project>
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
package com.froxynetwork.froxybungee;
2+
3+
import java.io.File;
4+
import java.io.IOException;
5+
import java.util.ArrayList;
6+
7+
import org.slf4j.Logger;
8+
import org.slf4j.LoggerFactory;
9+
10+
import net.md_5.bungee.config.Configuration;
11+
import net.md_5.bungee.config.ConfigurationProvider;
12+
import net.md_5.bungee.config.YamlConfiguration;
13+
14+
/**
15+
* FroxyBungee
16+
* Copyright (C) 2019 FroxyNetwork
17+
*
18+
* This program is free software: you can redistribute it and/or modify
19+
* it under the terms of the GNU General Public License as published by
20+
* the Free Software Foundation, either version 3 of the License, or
21+
* (at your option) any later version.
22+
*
23+
* This program is distributed in the hope that it will be useful,
24+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26+
* GNU General Public License for more details.
27+
*
28+
* You should have received a copy of the GNU General Public License
29+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
30+
*
31+
* @author 0ddlyoko
32+
*/
33+
public class Config {
34+
private final Logger LOG = LoggerFactory.getLogger(getClass());
35+
private File fichierConfig = null;
36+
private Configuration config = null;
37+
38+
public Config(File file) {
39+
this.fichierConfig = file;
40+
loadConfig();
41+
}
42+
43+
public void save() {
44+
try {
45+
ConfigurationProvider.getProvider(YamlConfiguration.class).save(config, fichierConfig);
46+
} catch (IOException e) {
47+
LOG.error("An error has occured while saving file {}", fichierConfig.getPath());
48+
}
49+
}
50+
51+
public void loadConfig() {
52+
try {
53+
config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(fichierConfig);
54+
} catch (IOException ex) {
55+
ex.printStackTrace();
56+
}
57+
}
58+
59+
public void set(String path, Object obj) {
60+
config.set(path, obj);
61+
save();
62+
}
63+
64+
public String getString(String path) {
65+
return getString(path, new Object[] {});
66+
}
67+
68+
public String getString(String path, Object... lists) {
69+
String name = config.getString(path);
70+
if (name != null && lists != null)
71+
for (int i = 0; i < lists.length; i++)
72+
name = name.replace("{" + i + "}", lists[i].toString());
73+
74+
return name == null ? null : name.replace("&", "§");
75+
}
76+
77+
public int getInt(String path) {
78+
return config.getInt(path);
79+
}
80+
81+
public long getLong(String path) {
82+
return config.getLong(path);
83+
}
84+
85+
public boolean getBoolean(String path) {
86+
return config.getBoolean(path);
87+
}
88+
89+
public double getDouble(String path) {
90+
return config.getDouble(path);
91+
}
92+
93+
public ArrayList<String> getStringList(String path) {
94+
ArrayList<String> name = new ArrayList<String>();
95+
for (String nom : config.getStringList(path))
96+
name.add(nom.replace("&", "§"));
97+
return name;
98+
}
99+
100+
public ArrayList<Integer> getIntegerList(String path) {
101+
ArrayList<Integer> name = new ArrayList<Integer>();
102+
for (int nom : config.getIntList(path))
103+
name.add(nom);
104+
return name;
105+
}
106+
107+
public ArrayList<String> getKeys(String path) {
108+
ArrayList<String> list = new ArrayList<>();
109+
if ("".equalsIgnoreCase(path)) {
110+
for (String section : config.getKeys())
111+
list.add(section);
112+
} else {
113+
Configuration cs = config.getSection(path);
114+
if (cs == null)
115+
return list;
116+
for (String section : cs.getKeys())
117+
list.add(section);
118+
}
119+
return list;
120+
}
121+
122+
public boolean exist(String path) {
123+
return config.contains(path);
124+
}
125+
126+
public void reload() {
127+
loadConfig();
128+
}
129+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.froxynetwork.froxybungee;
2+
3+
import com.froxynetwork.froxybungee.server.ServerManager;
4+
import com.froxynetwork.froxybungee.websocket.WebSocketManager;
5+
import com.froxynetwork.froxynetwork.network.NetworkManager;
6+
import com.froxynetwork.froxynetwork.network.output.data.server.ServerDataOutput.Server;
7+
8+
import lombok.Getter;
9+
import net.md_5.bungee.api.ProxyServer;
10+
11+
/**
12+
* FroxyBungee
13+
* Copyright (C) 2019 FroxyNetwork
14+
*
15+
* This program is free software: you can redistribute it and/or modify
16+
* it under the terms of the GNU General Public License as published by
17+
* the Free Software Foundation, either version 3 of the License, or
18+
* (at your option) any later version.
19+
*
20+
* This program is distributed in the hope that it will be useful,
21+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23+
* GNU General Public License for more details.
24+
*
25+
* You should have received a copy of the GNU General Public License
26+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
27+
*
28+
* @author 0ddlyoko
29+
*/
30+
/**
31+
* Represents the API core, for version and API singleton handling
32+
*/
33+
public final class Froxy {
34+
private static boolean init = false;
35+
36+
@Getter
37+
private static WebSocketManager webSocketManager;
38+
@Getter
39+
private static NetworkManager networkManager;
40+
@Getter
41+
private static ServerManager serverManager;
42+
@Getter
43+
private static Server server;
44+
45+
private static ProxyServer bungee;
46+
47+
private Froxy() {
48+
}
49+
50+
public static void init(WebSocketManager webSocketManager, NetworkManager networkManager,
51+
ServerManager serverManager, ProxyServer bungee, Server server) {
52+
if (init)
53+
throw new UnsupportedOperationException("Cannot call init if already loaded");
54+
Froxy.webSocketManager = webSocketManager;
55+
Froxy.networkManager = networkManager;
56+
Froxy.bungee = bungee;
57+
Froxy.serverManager = serverManager;
58+
Froxy.server = server;
59+
init = true;
60+
}
61+
62+
// ------------------------------------------------------------
63+
64+
/**
65+
* @return A {@link ProxyServer} instance for using bungee
66+
*/
67+
public static ProxyServer bungee() {
68+
return bungee;
69+
}
70+
}

0 commit comments

Comments
 (0)