本文整理汇总了Java中net.samagames.survivalapi.SurvivalAPI类的典型用法代码示例。如果您正苦于以下问题:Java SurvivalAPI类的具体用法?Java SurvivalAPI怎么用?Java SurvivalAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SurvivalAPI类属于net.samagames.survivalapi包,在下文中一共展示了SurvivalAPI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SurvivalTeam
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param game Team based game instance
* @param name Team's name
* @param color Team's color
* @param chatColor Team's color in chat
*/
public SurvivalTeam(SurvivalTeamGame game, String name, DyeColor color, ChatColor chatColor)
{
this.game = game;
this.teamName = name;
this.chatColor = chatColor;
this.icon = new ItemStack(Material.WOOL, 1, color.getData());
this.maxSize = game.getPersonsPerTeam();
this.invited = new ArrayList<>();
this.players = new HashMap<>();
SurvivalAPI.get().registerEvent(SurvivalAPI.EventType.WORLDLOADED, () ->
{
Scoreboard board = game.getScoreboard();
this.team = board.registerNewTeam("meow" + chatColor.getChar());
this.team.setDisplayName(name);
this.team.setCanSeeFriendlyInvisibles(true);
this.team.setPrefix(chatColor + "");
this.team.setSuffix(ChatColor.RESET + "");
});
}
示例2: onEnable
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
@Override
public void onEnable()
{
SurvivalGame game;
int nb = SamaGamesAPI.get().getGameManager().getGameProperties().getOption("playersPerTeam", new JsonPrimitive(1)).getAsInt();
SurvivalAPI.get().loadModule(OneShieldModule.class, null);
if (nb > 1)
game = new RunBasedTeamGame<>(this, "uhcrun", "UHCRun", "L’expérience d’un UHC en 30 minutes", "=", RunBasedGameLoop.class, nb);
else
game = new RunBasedSoloGame<>(this, "uhcrun", "UHCRun", "L’expérience d’un UHC en 30 minutes", "=", RunBasedGameLoop.class);
SamaGamesAPI.get().getGameManager().setMaxReconnectTime(20);
SamaGamesAPI.get().getStatsManager().setStatsToLoad(GamesNames.UHCRUN, true);
SamaGamesAPI.get().getShopsManager().setShopToLoad(GamesNames.UHCRUN, true);
SamaGamesAPI.get().getGameManager().setGameStatisticsHelper(new UHCRunStatisticsHelper());
SamaGamesAPI.get().getGameManager().registerGame(game);
}
示例3: createWaitingBlockRemovingEvent
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
public void createWaitingBlockRemovingEvent()
{
this.nextEvent = new TimedEvent(0, 10, "Suppression des cages", ChatColor.GREEN, true, () ->
{
this.game.removeWaitingBlocks();
this.blocksProtected = false;
this.createDamageEvent();
SurvivalAPI.get().fireGameStart(this.game);
});
}
示例4: onWorldLoad
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Listen when world loaded
*/
@EventHandler
public void onWorldLoad(WorldLoadEvent event)
{
if (event.getWorld().equals(Bukkit.getWorlds().get(0)))
SurvivalAPI.get().fireEvents(SurvivalAPI.EventType.WORLDLOADED);
}
示例5: downloadWorld
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Download the map
*/
public void downloadWorld()
{
SurvivalPlugin apiplugin = SurvivalAPI.get().getPlugin();
File worldDir = new File(apiplugin.getDataFolder().getAbsoluteFile().getParentFile().getParentFile(), "world");
apiplugin.getLogger().info("Checking wether world exists at : " + worldDir.getAbsolutePath());
if (!worldDir.exists())
{
apiplugin.getLogger().severe("World's folder not found. Aborting!");
Bukkit.shutdown();
}
apiplugin.getLogger().info("World's folder found... Checking for arena file...");
WorldDownloader worldDownloader = new WorldDownloader(apiplugin);
if (SamaGamesAPI.get().getGameManager().getGameProperties().getMapProperty("local-map", new JsonPrimitive(false)).getAsBoolean())
{
apiplugin.getLogger().info("Using local map instead of downloading one");
return ;
}
if (!worldDownloader.checkAndDownloadWorld(worldDir, getDownloadWorldLink()))
{
if (!new File(worldDir, "override.tmp").exists())
{
apiplugin.getLogger().severe("Error during map downloading. Aborting!");
Bukkit.shutdown();
}
}
}
示例6: getDownloadWorldLink
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Override this to modify download link
* @return Url to the map
*/
public String getDownloadWorldLink()
{
JsonElement worldStorage = SamaGamesAPI.get().getGameManager().getGameProperties().getMapProperty("worldStorage", null);
if (worldStorage == null)
return null;
String map = worldStorage.getAsString();
if (map != null && SurvivalAPI.get().getCustomMapName() != null)
{
map = map.substring(0, map.length() - 1);
map += '/' + SurvivalAPI.get().getCustomMapName() + "/";
}
return map;
}
示例7: MobOresModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public MobOresModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
Validate.notNull(moduleConfiguration, "Configuration cannot be null!");
this.random = new Random();
}
示例8: SpawnEggsModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public SpawnEggsModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
Validate.notNull(moduleConfiguration, "Configuration cannot be null!");
this.entities = (List<EntityType>) moduleConfiguration.get("entities");
this.random = new Random();
}
示例9: InfestationModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public InfestationModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
Validate.notNull(moduleConfiguration, "Configuration cannot be null!");
this.random = new Random();
}
示例10: RottenPotionsModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public RottenPotionsModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
Validate.notNull(moduleConfiguration, "Configuration cannot be null!");
this.random = new Random();
}
示例11: LoveMachineModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public LoveMachineModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
this.couples = new ArrayList<>();
plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, this, 20L, 20L);
}
示例12: OneHealModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public OneHealModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
this.hoe = new ItemStack(Material.GOLD_HOE);
ItemMeta meta = this.hoe.getItemMeta();
meta.setLore(Arrays.asList("Utilisez là pour vous regen toute votre vie.", "Attention, elle est à usage unique."));
meta.setDisplayName(ChatColor.GOLD + "Heal");
this.hoe.setItemMeta(meta);
}
示例13: RapidUsefulModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public RapidUsefulModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
Validate.notNull(moduleConfiguration, "Configuration cannot be null!");
this.drops = (Map<ItemStack, ConfigurationBuilder.IRapidUsefulHook>) moduleConfiguration.get("drops");
this.random = new Random();
}
示例14: PotentialHeartsModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public PotentialHeartsModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
Validate.notNull(moduleConfiguration, "Configuration cannot be null!");
this.maxHealth = (double) moduleConfiguration.get("max-health");
}
示例15: TheHobbitModule
import net.samagames.survivalapi.SurvivalAPI; //导入依赖的package包/类
/**
* Constructor
*
* @param plugin Parent plugin
* @param api API instance
* @param moduleConfiguration Module configuration
*/
public TheHobbitModule(SurvivalPlugin plugin, SurvivalAPI api, Map<String, Object> moduleConfiguration)
{
super(plugin, api, moduleConfiguration);
Validate.notNull(moduleConfiguration, "Configuration cannot be null!");
this.bonusTime = (int) moduleConfiguration.get("bonus-time");
this.ring = new ItemStack(Material.GOLD_NUGGET);
ItemMeta meta = this.ring.getItemMeta();
meta.setLore(Arrays.asList("Une fois utilisé, cet anneau vous", "permettra d'être invisible pendant", this.bonusTime + " secondes."));
meta.setDisplayName(ChatColor.GOLD + "Anneau");
this.ring.setItemMeta(meta);
}