Skip to content

Commit

Permalink
ajout de l'api de la cite des elements
Browse files Browse the repository at this point in the history
  • Loading branch information
NeutronStars committed Aug 11, 2019
1 parent 12ae308 commit 9953300
Show file tree
Hide file tree
Showing 37 changed files with 1,973 additions and 0 deletions.
194 changes: 194 additions & 0 deletions src/fr/neutronstars/sands_city/api/IElementCity.java
@@ -0,0 +1,194 @@
package fr.neutronstars.sands_city.api;

import fr.neutronstars.sands_city.api.display.DisplayManager;
import fr.neutronstars.sands_city.api.entities.IPlayerManager;
import fr.neutronstars.sands_city.api.inventory.*;
import fr.neutronstars.sands_city.api.money.IMoneyManager;
import fr.neutronstars.sands_city.api.sql.ISQLManager;
import fr.neutronstars.sands_city.api.team.ITeamManager;
import fr.neutronstars.sands_city.api.utils.IConfiguration;
import fr.neutronstars.sands_city.api.utils.MessageBuilder;
import fr.neutronstars.sands_city.api.utils.VillagerManager;
import fr.neutronstars.sands_city.api.zone.HouseManager;
import fr.neutronstars.sands_city.api.zone.ZoneArea;
import fr.neutronstars.sands_city.api.zone.ZoneManager;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.JSONObject;

import java.io.File;
import java.io.IOException;
import java.util.Optional;
import java.util.logging.Logger;

/**
Cette class sert de point de relais entre toutes les autres.
*/

public abstract class IElementCity
{
private static IElementCity elementCity;

/**
* Récupére l'instance principal de la class.
* @return sandsCity
*/
public static IElementCity getElementCity()
{
return elementCity;
}

/**
* Permet d'inialiser sandsCity lors du démarrage du server. Il ne dois pas être utiliser dans les projets.
* @param elementCity
*/
public static void setElementCity(IElementCity elementCity)
{
if(IElementCity.elementCity != null)
throw new IllegalArgumentException("Cannot be set new Instance of IElementCity !");
IElementCity.elementCity = elementCity;
}

public abstract String getPrefix();

/**
* Retourne le logger principal du plugin.
* @return logger
*/
public abstract Logger getLogger();

public abstract JavaPlugin getPlugin();

/**
* Retourne le dossier principal de l'API.
* @return folder
*/
public abstract File getFolder();

/**
* Retourne le fichier de configuration de l'api.
* @return configuration
*/
public abstract IConfiguration getConfiguration();

/**
* Retourne La gestion de la base de donnée.
* @return sqlManager
*/
public abstract ISQLManager getSQLManager();

/**
* Retourne la gestion de money
* @return moneyManager
*/
public abstract IMoneyManager getMoneyManager();

/**
* Retourne une configuration JSON qui s'appelle "name". Si celle ci n'existe pas, elle créer un fichier vide.
* @param name
* @return iConfiguration
*/
public abstract IConfiguration getConfiguration(String name) throws IOException;

/**
* Retourne la gestion des joueurs du serveur.
* @return iPlayerManager
*/
public abstract IPlayerManager getPlayerManager();

/**
* Retourne la gestion des teams du serveur.
* @return iTeamManager
*/
public abstract ITeamManager getTeamManager();

public abstract IInventoryManager getInventoryManager();

public abstract Optional<String> getArgsDetect(String arg, String... args);

public abstract Location parseLocation(String location);

public abstract MessageBuilder createMessageBuilder(String text);

public abstract MessageBuilder createMessageBuilder(ChatColor color, String text);

public abstract MessageBuilder createMessageBuilder(BaseComponent component);

public abstract MessageBuilder createMessageBuilder(MessageBuilder builder);

public abstract ItemBuilder createItemBuilder(ItemStack itemStack);

public abstract ItemBuilder createItemBuilder(Material material);

public abstract ItemBuilder createItemBuilder(Material material, int count);

public abstract ItemBuilder createItemBuilder(Material material, int count, int data);

public abstract ItemBuilder createItemBuilder(ItemBuilder builder);

public abstract IInventory createInventory(String title, int slotCount);

public abstract IItem createItem(ItemBuilder itemBuilder, IInventory inventory, ItemClick click);

public abstract ZoneManager getZoneManager();

public abstract ZoneArea createQuadZone(String name, Location a, Location b);

public abstract ZoneArea createCircleZone(String name, Location center, int height, int radius);

public abstract HouseManager getHouseManager();

public abstract Optional<ZoneArea> parseZoneArea(JSONObject object);

public abstract VillagerManager getVillagerManager();

public abstract Block getTargetBlock(Player player, int range);

public abstract DisplayManager getDisplayManager();

public abstract boolean hasTeamInfoCredit();

public abstract void setTeamInfoCredit(boolean teamInfoCredit);

public abstract boolean canEnteredHouse();

public abstract void setEnteredHouse(boolean enteredHouse);

public abstract boolean hasPVPActive();

public abstract void setPVPActive(boolean active);

public abstract boolean hasHomeActive();

public abstract void setHomeActive(boolean active);

public abstract boolean canEnteredServer();

public abstract void setEnteredServer(boolean enteredServer);

public abstract boolean hasFrendlyFire();

public abstract void setFrendlyFire(boolean frendlyFire);

public abstract boolean hasBankActive();

public abstract void setBankActive(boolean bankActive);

public abstract boolean hasSpleef();

public abstract void setSpleef(boolean spleef);

public abstract boolean canKillPig();

public abstract void setKillPig(boolean killPig);

public abstract boolean hasDisplay();

public abstract void setDisplay(boolean display);
}
22 changes: 22 additions & 0 deletions src/fr/neutronstars/sands_city/api/display/Display.java
@@ -0,0 +1,22 @@
/**
* Copyright 2019 NeutronStars
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package fr.neutronstars.sands_city.api.display;

public interface Display
{
DisplayType getType();
void update();
}
22 changes: 22 additions & 0 deletions src/fr/neutronstars/sands_city/api/display/DisplayManager.java
@@ -0,0 +1,22 @@
/**
* Copyright 2019 NeutronStars
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package fr.neutronstars.sands_city.api.display;

public interface DisplayManager
{
Display getDisplay(DisplayType displayType);
void update();
}
59 changes: 59 additions & 0 deletions src/fr/neutronstars/sands_city/api/display/DisplayType.java
@@ -0,0 +1,59 @@
/**
* Copyright 2019 NeutronStars
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package fr.neutronstars.sands_city.api.display;

import fr.neutronstars.sands_city.api.team.TeamType;

public enum DisplayType
{
TEAM("§6§lClassement des équipes", "%1$s: §6%2$s §2Emeraudes"),
PLAYER("§6§lTOP JOUEURS", "%1$s: §6%2$s §2Emeraudes"),
FIRE_1("FIRE", "§6Classement de l'équipe "+ TeamType.FIRE.getColor()+ TeamType.FIRE.getName(), "%1$s§f: §6%2$s §2Emeraudes"),
WIND_1("WIND", "§6Classement de l'équipe "+ TeamType.WIND.getColor()+ TeamType.WIND.getName(), "%1$s§f: §6%2$s §2Emeraudes"),
WATER_1("WATER", "§6Classement de l'équipe "+ TeamType.WATER.getColor()+ TeamType.WATER.getName(), "%1$s§f: §6%2$s §2Emeraudes"),
GROUND_1("GROUND", "§6Classement de l'équipe "+ TeamType.GROUND.getColor()+ TeamType.GROUND.getName(), "%1$s§f: §6%2$s §2Emeraudes"),
FIRE_2("FIRE", "§6Classement de l'équipe "+ TeamType.FIRE.getColor()+ TeamType.FIRE.getName(), "%1$s§f: §6%2$s §2Emeraudes"),
WIND_2("WIND", "§6Classement de l'équipe "+ TeamType.WIND.getColor()+ TeamType.WIND.getName(), "%1$s§f: §6%2$s §2Emeraudes"),
WATER_2("WATER", "§6Classement de l'équipe "+ TeamType.WATER.getColor()+ TeamType.WATER.getName(), "%1$s§f: §6%2$s §2Emeraudes"),
GROUND_2("GROUND", "§6Classement de l'équipe "+ TeamType.GROUND.getColor()+ TeamType.GROUND.getName(), "%1$s§f: §6%2$s §2Emeraudes");

private final String titleFormat, lineFormat, team;

DisplayType(String titleFormat, String lineFormat){
this("", titleFormat, lineFormat);
}

DisplayType(String team, String titleFormat, String lineFormat){
this.team = team;
this.titleFormat = titleFormat;
this.lineFormat = lineFormat;
}

public String getTeam()
{
return team;
}

public String getTitleFormat()
{
return titleFormat;
}

public String getLineFormat()
{
return lineFormat;
}
}
56 changes: 56 additions & 0 deletions src/fr/neutronstars/sands_city/api/entities/ICustomPlayer.java
@@ -0,0 +1,56 @@
package fr.neutronstars.sands_city.api.entities;

import fr.neutronstars.sands_city.api.inventory.IInventory;
import fr.neutronstars.sands_city.api.team.ITeam;
import fr.neutronstars.sands_city.api.zone.House;
import fr.neutronstars.sands_city.api.zone.ZoneArea;

import java.util.Optional;
import java.util.UUID;

/**
* Permet de stoquer les donnée du joueur et d'interagir avec.
*/
public interface ICustomPlayer
{
/**
* Récupère l'identifiant unique d'un joueur.
* @return uuid
*/
UUID getUniqueId();

/**
* Récupere le nom du joueur.
* @return name
*/
String getName();

/**
* Récupère la team du joueur.
*
* @return iTeam
*/
ITeam getTeam();

Optional<ZoneArea> getZoneArea();

void setZoneArea(ZoneArea zoneArea);

Optional<House> getHouse();

void setHouse(House house);

Optional<IInventory> getInventory();

void setInventory(IInventory inventory);

/**
* Sauvegarder les données du joueur dans la base de donnée.
*/

boolean hasCyberNeutronSecurity();

void setCyberNeutronSecurity(boolean cyberNeutronSecurity);

void save();
}
18 changes: 18 additions & 0 deletions src/fr/neutronstars/sands_city/api/entities/IPlayerManager.java
@@ -0,0 +1,18 @@
package fr.neutronstars.sands_city.api.entities;

import org.bukkit.entity.Player;

import java.util.List;
import java.util.function.Consumer;

/**
* Gére la liste des joueurs connecté.
*/

public interface IPlayerManager
{
List<ICustomPlayer> getPlayers();
void getPlayers(Consumer<ICustomPlayer> player);

ICustomPlayer getPlayer(Player player);
}

0 comments on commit 9953300

Please sign in to comment.