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

Commit 37c650f

Browse files
committed
Merge branch 'release/0.1.4'
2 parents dc17a9b + b1043fb commit 37c650f

17 files changed

Lines changed: 1414 additions & 412 deletions

LICENSE

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

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Partie api qui sera sur les serveurs Spigot pour le projet Froxy-Network
44
Ce dépôt contient les sources et la documentation pour la partie FroxyAPI.
55

66
## Librairies
7-
- [slf4j](https://www.slf4j.org/)
8-
- [lombok](https://github.com/rzwitserloot/lombok)
9-
- [Spigot](https://www.spigotmc.org/)
7+
- [slf4j](https://www.slf4j.org/)
8+
- [lombok](https://github.com/rzwitserloot/lombok)
9+
- [Spigot](https://www.spigotmc.org/)
1010

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

14-
* MIT
14+
- GNU General Public License

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.froxynetwork</groupId>
77
<artifactId>FroxyAPI</artifactId>
8-
<version>0.0.5</version>
8+
<version>0.1.4</version>
99
<packaging>jar</packaging>
1010

1111
<name>FroxyAPI</name>
Lines changed: 135 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package com.froxynetwork.froxyapi;
22

33
import java.io.File;
4+
import java.util.Date;
45
import java.util.List;
6+
import java.util.UUID;
57

68
import org.bukkit.Server;
79
import org.bukkit.entity.Player;
810
import org.bukkit.plugin.java.JavaPlugin;
9-
import org.slf4j.Logger;
1011

1112
import com.froxynetwork.froxyapi.command.Command;
1213
import com.froxynetwork.froxyapi.command.CommandManager;
@@ -15,37 +16,38 @@
1516
import com.froxynetwork.froxyapi.inventory.InventoryProvider;
1617
import com.froxynetwork.froxyapi.language.LanguageManager;
1718
import com.froxynetwork.froxyapi.language.Languages;
19+
import com.froxynetwork.froxyapi.player.PlayerManager;
1820

1921
/**
20-
* MIT License
21-
*
22-
* Copyright (c) 2019 FroxyNetwork
23-
*
24-
* Permission is hereby granted, free of charge, to any person obtaining a copy
25-
* of this software and associated documentation files (the "Software"), to deal
26-
* in the Software without restriction, including without limitation the rights
27-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28-
* copies of the Software, and to permit persons to whom the Software is
29-
* furnished to do so, subject to the following conditions:
30-
*
31-
* The above copyright notice and this permission notice shall be included in
32-
* all copies or substantial portions of the Software.
33-
*
34-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40-
* SOFTWARE.
22+
* FroxyAPI
4123
*
24+
* Copyright (C) 2019 FroxyNetwork
25+
*
26+
* This program is free software: you can redistribute it and/or modify
27+
* it under the terms of the GNU General Public License as published by
28+
* the Free Software Foundation, either version 3 of the License, or
29+
* (at your option) any later version.
30+
*
31+
* This program is distributed in the hope that it will be useful,
32+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
33+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34+
* GNU General Public License for more details.
35+
*
36+
* You should have received a copy of the GNU General Public License
37+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
38+
*
4239
* @author 0ddlyoko
4340
*/
4441
/**
4542
* Interface for all methods (like {@link Server} for Spigot)
4643
*/
4744
public interface API {
4845

46+
/**
47+
* Register specific plugin as the game
48+
*/
49+
public void register(JavaPlugin plugin);
50+
4951
/**
5052
* @return The JavaPlugin implementation of the Core plugin
5153
*/
@@ -55,21 +57,36 @@ public interface API {
5557
* @return The JavaPlugin implementation of the Game plugin
5658
*/
5759
public JavaPlugin getGamePlugin();
58-
60+
5961
/**
60-
* @return The version of the actual Core
62+
* @return The id of this server
6163
*/
62-
public String getVersion();
64+
public String getId();
65+
66+
/**
67+
* @return The name of this server
68+
*/
69+
public String getName();
70+
71+
/**
72+
* @return The type of this server
73+
*/
74+
public String getType();
6375

6476
/**
65-
* @return The logger
77+
* @return The creation time of this server
6678
*/
67-
public Logger getLogger();
79+
public Date getCreationTime();
80+
81+
/**
82+
* @return The version of the actual Core
83+
*/
84+
public String getVersion();
6885

6986
// -----------------------------------------
70-
// | |
71-
// | Language Manager |
72-
// | |
87+
//
88+
// Language Manager
89+
//
7390
// -----------------------------------------
7491

7592
/**
@@ -90,8 +107,7 @@ public default Languages getDefaultLanguage() {
90107
* Files name MUST be of this form: "{name}.lang".<br />
91108
* Example: <code>fr_FR.lang or en_US.lang</code>
92109
*
93-
* @param path
94-
* The directory
110+
* @param path The directory
95111
*/
96112
public default void register(File path) {
97113
getLanguageManager().register(path);
@@ -101,10 +117,8 @@ public default void register(File path) {
101117
* Get the default translate of specific message id.<br />
102118
* Same as <code>$(id, getDefaultLanguage(), params)</code>
103119
*
104-
* @param id
105-
* The id of the message
106-
* @param params
107-
* The parameters
120+
* @param id The id of the message
121+
* @param params The parameters
108122
* @return The message translated by default language, or the id if message id
109123
* doesn't exist
110124
*/
@@ -116,12 +130,9 @@ public default void register(File path) {
116130
* Get the translation of specific message id with specific language. If message
117131
* id not found, return the translation with DEFAULT language
118132
*
119-
* @param id
120-
* The id of the message
121-
* @param lang
122-
* The specific language
123-
* @param params
124-
* The parameters
133+
* @param id The id of the message
134+
* @param lang The specific language
135+
* @param params The parameters
125136
* @return The message translated by specific language, or the message
126137
* translated by default language, or the id if message id doesn't exist
127138
*/
@@ -132,12 +143,9 @@ public default void register(File path) {
132143
/**
133144
* Get the translate of specific id with specific language
134145
*
135-
* @param id
136-
* The id of the message
137-
* @param lang
138-
* The specific language
139-
* @param params
140-
* The parameters
146+
* @param id The id of the message
147+
* @param lang The specific language
148+
* @param params The parameters
141149
* @return The message translated by specific language, or the id if message id
142150
* doesn't exist
143151
*/
@@ -146,9 +154,9 @@ public default void register(File path) {
146154
}
147155

148156
// -----------------------------------------
149-
// | |
150-
// | Command Manager |
151-
// | |
157+
// |
158+
// | Command Manager
159+
// |
152160
// -----------------------------------------
153161

154162
/**
@@ -159,8 +167,7 @@ public default void register(File path) {
159167
/**
160168
* Register a command
161169
*
162-
* @param cmd
163-
* The command
170+
* @param cmd The command
164171
*/
165172
public default void registerCommand(Command cmd) {
166173
getCommandManager().registerCommand(cmd);
@@ -169,8 +176,7 @@ public default void registerCommand(Command cmd) {
169176
/**
170177
* Unregister a command
171178
*
172-
* @param cmd
173-
* The command
179+
* @param cmd The command
174180
*/
175181
public default void unregisterCommand(Command cmd) {
176182
getCommandManager().unregisterCommand(cmd);
@@ -184,9 +190,9 @@ public default List<Command> getCommands() {
184190
}
185191

186192
// -----------------------------------------
187-
// | |
188-
// | Inventory Manager |
189-
// | |
193+
// |
194+
// | Inventory Manager
195+
// |
190196
// -----------------------------------------
191197

192198
/**
@@ -197,19 +203,16 @@ public default List<Command> getCommands() {
197203
/**
198204
* Create an Inventory and open it
199205
*
200-
* @param provider
201-
* The provider
202-
* @param player
203-
* The player
206+
* @param provider The provider
207+
* @param player The player
204208
* @return An inventory
205209
*/
206210
public default Inventory openInventory(InventoryProvider provider, Player player) {
207211
return getInventoryManager().openInventory(provider, player);
208212
}
209213

210214
/**
211-
* @param p
212-
* Player to check
215+
* @param p Player to check
213216
*
214217
* @return true if specific Player has an opened inventory
215218
*/
@@ -218,8 +221,7 @@ public default boolean hasInventoryOpened(Player p) {
218221
}
219222

220223
/**
221-
* @param p
222-
* Specific player
224+
* @param p Specific player
223225
* @return The inventory of specific Player. Null if not opened
224226
*/
225227
public default Inventory getInventory(Player p) {
@@ -230,10 +232,75 @@ public default Inventory getInventory(Player p) {
230232
* Close player's inventory.<br />
231233
* Same as <code>p.closeInventory();</code>
232234
*
233-
* @param p
234-
* The player
235+
* @param p The player
235236
*/
236237
public default void closeInventory(Player p) {
237238
getInventoryManager().closeInventory(p);
238239
}
240+
241+
// -----------------------------------------
242+
// |
243+
// | Player Manager
244+
// |
245+
// -----------------------------------------
246+
247+
/**
248+
* @return The PlayerManager
249+
*/
250+
public PlayerManager getPlayerManager();
251+
252+
/**
253+
* @param name The name of the player
254+
* @return The player or null if not found
255+
*/
256+
public default com.froxynetwork.froxyapi.player.Player getPlayer(String name) {
257+
return getPlayerManager().getPlayer(name);
258+
}
259+
260+
/**
261+
* @param uuid The uuid of the player
262+
* @return The player or null if not found
263+
*/
264+
public default com.froxynetwork.froxyapi.player.Player getPlayer(UUID uuid) {
265+
return getPlayerManager().getPlayer(uuid);
266+
}
267+
268+
/**
269+
* @return An immutable list containing all players
270+
*/
271+
public default List<? extends com.froxynetwork.froxyapi.player.Player> getPlayers() {
272+
return getPlayerManager().getPlayers();
273+
}
274+
275+
/**
276+
* Edit kill time. Set to -1 to keep last kill or 0 to disable it
277+
*
278+
* @param time The new time in seconds
279+
*/
280+
public default void setKillTime(int time) {
281+
getPlayerManager().setKillTime(time);
282+
}
283+
284+
/**
285+
* @return The current kill time
286+
*/
287+
public default int getKillTime() {
288+
return getPlayerManager().getKillTime();
289+
}
290+
291+
/**
292+
* Edit assist time. Set to -1 to keep all assists or 0 to disable it
293+
*
294+
* @param time The new time in seconds
295+
*/
296+
public default void setAssistTime(int time) {
297+
getPlayerManager().setAssistTime(time);
298+
}
299+
300+
/**
301+
* @return The current assist time
302+
*/
303+
public default int getAssistTime() {
304+
return getPlayerManager().getAssistTime();
305+
}
239306
}

0 commit comments

Comments
 (0)