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

Commit 43effcd

Browse files
committed
A lot of changes
1 parent 04ee5b2 commit 43effcd

15 files changed

Lines changed: 584 additions & 160 deletions

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-
* GNU General Public License
14+
- GNU General Public License

src/main/java/com/froxynetwork/froxyapi/API.java

Lines changed: 120 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
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;
@@ -14,9 +16,11 @@
1416
import com.froxynetwork.froxyapi.inventory.InventoryProvider;
1517
import com.froxynetwork.froxyapi.language.LanguageManager;
1618
import com.froxynetwork.froxyapi.language.Languages;
19+
import com.froxynetwork.froxyapi.player.PlayerManager;
1720

1821
/**
1922
* FroxyAPI
23+
*
2024
* Copyright (C) 2019 FroxyNetwork
2125
*
2226
* This program is free software: you can redistribute it and/or modify
@@ -39,6 +43,11 @@
3943
*/
4044
public interface API {
4145

46+
/**
47+
* Register specific plugin as the game
48+
*/
49+
public void register(JavaPlugin plugin);
50+
4251
/**
4352
* @return The JavaPlugin implementation of the Core plugin
4453
*/
@@ -48,16 +57,36 @@ public interface API {
4857
* @return The JavaPlugin implementation of the Game plugin
4958
*/
5059
public JavaPlugin getGamePlugin();
60+
61+
/**
62+
* @return The id of this server
63+
*/
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();
5175

76+
/**
77+
* @return The creation time of this server
78+
*/
79+
public Date getCreationTime();
80+
5281
/**
5382
* @return The version of the actual Core
5483
*/
5584
public String getVersion();
5685

5786
// -----------------------------------------
58-
// | |
59-
// | Language Manager |
60-
// | |
87+
//
88+
// Language Manager
89+
//
6190
// -----------------------------------------
6291

6392
/**
@@ -78,8 +107,7 @@ public default Languages getDefaultLanguage() {
78107
* Files name MUST be of this form: "{name}.lang".<br />
79108
* Example: <code>fr_FR.lang or en_US.lang</code>
80109
*
81-
* @param path
82-
* The directory
110+
* @param path The directory
83111
*/
84112
public default void register(File path) {
85113
getLanguageManager().register(path);
@@ -89,10 +117,8 @@ public default void register(File path) {
89117
* Get the default translate of specific message id.<br />
90118
* Same as <code>$(id, getDefaultLanguage(), params)</code>
91119
*
92-
* @param id
93-
* The id of the message
94-
* @param params
95-
* The parameters
120+
* @param id The id of the message
121+
* @param params The parameters
96122
* @return The message translated by default language, or the id if message id
97123
* doesn't exist
98124
*/
@@ -104,12 +130,9 @@ public default void register(File path) {
104130
* Get the translation of specific message id with specific language. If message
105131
* id not found, return the translation with DEFAULT language
106132
*
107-
* @param id
108-
* The id of the message
109-
* @param lang
110-
* The specific language
111-
* @param params
112-
* The parameters
133+
* @param id The id of the message
134+
* @param lang The specific language
135+
* @param params The parameters
113136
* @return The message translated by specific language, or the message
114137
* translated by default language, or the id if message id doesn't exist
115138
*/
@@ -120,12 +143,9 @@ public default void register(File path) {
120143
/**
121144
* Get the translate of specific id with specific language
122145
*
123-
* @param id
124-
* The id of the message
125-
* @param lang
126-
* The specific language
127-
* @param params
128-
* The parameters
146+
* @param id The id of the message
147+
* @param lang The specific language
148+
* @param params The parameters
129149
* @return The message translated by specific language, or the id if message id
130150
* doesn't exist
131151
*/
@@ -134,9 +154,9 @@ public default void register(File path) {
134154
}
135155

136156
// -----------------------------------------
137-
// | |
138-
// | Command Manager |
139-
// | |
157+
// |
158+
// | Command Manager
159+
// |
140160
// -----------------------------------------
141161

142162
/**
@@ -147,8 +167,7 @@ public default void register(File path) {
147167
/**
148168
* Register a command
149169
*
150-
* @param cmd
151-
* The command
170+
* @param cmd The command
152171
*/
153172
public default void registerCommand(Command cmd) {
154173
getCommandManager().registerCommand(cmd);
@@ -157,8 +176,7 @@ public default void registerCommand(Command cmd) {
157176
/**
158177
* Unregister a command
159178
*
160-
* @param cmd
161-
* The command
179+
* @param cmd The command
162180
*/
163181
public default void unregisterCommand(Command cmd) {
164182
getCommandManager().unregisterCommand(cmd);
@@ -172,9 +190,9 @@ public default List<Command> getCommands() {
172190
}
173191

174192
// -----------------------------------------
175-
// | |
176-
// | Inventory Manager |
177-
// | |
193+
// |
194+
// | Inventory Manager
195+
// |
178196
// -----------------------------------------
179197

180198
/**
@@ -185,19 +203,16 @@ public default List<Command> getCommands() {
185203
/**
186204
* Create an Inventory and open it
187205
*
188-
* @param provider
189-
* The provider
190-
* @param player
191-
* The player
206+
* @param provider The provider
207+
* @param player The player
192208
* @return An inventory
193209
*/
194210
public default Inventory openInventory(InventoryProvider provider, Player player) {
195211
return getInventoryManager().openInventory(provider, player);
196212
}
197213

198214
/**
199-
* @param p
200-
* Player to check
215+
* @param p Player to check
201216
*
202217
* @return true if specific Player has an opened inventory
203218
*/
@@ -206,8 +221,7 @@ public default boolean hasInventoryOpened(Player p) {
206221
}
207222

208223
/**
209-
* @param p
210-
* Specific player
224+
* @param p Specific player
211225
* @return The inventory of specific Player. Null if not opened
212226
*/
213227
public default Inventory getInventory(Player p) {
@@ -218,10 +232,75 @@ public default Inventory getInventory(Player p) {
218232
* Close player's inventory.<br />
219233
* Same as <code>p.closeInventory();</code>
220234
*
221-
* @param p
222-
* The player
235+
* @param p The player
223236
*/
224237
public default void closeInventory(Player p) {
225238
getInventoryManager().closeInventory(p);
226239
}
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+
}
227306
}

0 commit comments

Comments
 (0)