• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SamaGamesAPI类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.samagames.api.SamaGamesAPI的典型用法代码示例。如果您正苦于以下问题:Java SamaGamesAPI类的具体用法?Java SamaGamesAPI怎么用?Java SamaGamesAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SamaGamesAPI类属于net.samagames.api包,在下文中一共展示了SamaGamesAPI类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: HydroangeasManager

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
public HydroangeasManager(Hub hub)
{
    super(hub);

    this.connectionManager = new ConnectionManager(hub, this);
    this.packetReceiver = new PacketReceiver(hub);

    SamaGamesAPI.get().getPubSub().subscribe("hydroHubReceiver", (channel, packet) ->
    {
        try
        {
            this.connectionManager.getPacket(packet);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    });
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:20,代码来源:HydroangeasManager.java


示例2: playerJoin

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
public void playerJoin(final Player p)
{
    executor.execute(() -> {
        teamHandler.addReceiver(p);
        if(SamaGamesAPI.get().getServerOptions().hasRankTabColor())
        {
            final PermissionEntity user = manager.getPlayer(p.getUniqueId());
            //PlayerData playerData = api.getPlayerManager().getPlayerData(p.getUniqueId());
            TeamHandler.VTeam teamByName = teamHandler.getTeamByName(user.getDisplayGroupName());
            if (teamByName == null)
            {
                teamByName = teamHandler.getTeamByName("Joueur");
            }
            teamHandler.addPlayerToTeam(p, teamByName);
        }
    });
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:18,代码来源:TeamManager.java


示例3: setSpectator

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
/**
 * Puts this player into spectator mode.
 */
public void setSpectator()
{
    this.spectator = true;
    this.stepPlayedTimeCounter();

    Bukkit.getScheduler().runTask(SamaGamesAPI.get().getPlugin(), () ->
    {
        final Player bukkitPlayer = this.getPlayerIfOnline();

        if (bukkitPlayer == null)
            return;

        bukkitPlayer.setGameMode(GameMode.SPECTATOR);

        for (Player player : Bukkit.getOnlinePlayers())
            player.hidePlayer(bukkitPlayer);

        new FancyMessage("Cliquez ").color(ChatColor.YELLOW).style(ChatColor.BOLD).then("[ICI]").command("/hub").color(ChatColor.AQUA).style(ChatColor.BOLD).then(" pour retourner au hub !").color(ChatColor.YELLOW).style(ChatColor.BOLD).send(bukkitPlayer);
    });
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:24,代码来源:GamePlayer.java


示例4: Game

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
/**
 * @param gameCodeName The code name of the game, given by an administrator.
 * @param gameName The friendly name of the game.
 * @param gameDescription A short description of the game, displayed to the players
 *                        when they join the game through a /title.
 * @param gamePlayerClass The class of your custom {@link GamePlayer} object, the same
 *                        as the {@link GAMEPLAYER} class. Use {@code GamePlayer.class}
 *                        if you are not using a custom class.
 * @param gameCreators An array of the UUID of the creators of this game (used for
 *                     the achievement 'Play with the creator').
 */
public Game(String gameCodeName, String gameName, String gameDescription, Class<GAMEPLAYER> gamePlayerClass, UUID[] gameCreators)
{
    this.gameManager = SamaGamesAPI.get().getGameManager();
    this.gameCodeName = gameCodeName.toLowerCase();
    this.gameName = gameName;
    this.gameDescription = gameDescription;
    this.gamePlayerClass = gamePlayerClass;
    this.gameCreators = gameCreators != null ? Arrays.asList(gameCreators) : null;
    this.gameWinners = new ArrayList<>();
    this.gameModerators = new ArrayList<>();
    this.gamePlayers = new HashMap<>();
    this.gameSpectators = new HashMap<>();
    this.advertisingTask = new AdvertisingTask();

    this.status = Status.WAITING_FOR_PLAYERS;
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:28,代码来源:Game.java


示例5: handleWinner

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
/**
 * Call this method to modify the statistics of the
 * given winner.
 *
 * @param uuid UUID of the winner
 */
public void handleWinner(UUID uuid)
{
    if (this.gameManager.isFreeMode())
        throw new UnsupportedOperationException("You can't use this method while using the free mode!");

    try
    {
        this.gameWinners.add(uuid);

        if (this.gameManager.getGameStatisticsHelper() != null)
            this.gameManager.getGameStatisticsHelper().increaseWins(uuid);

        SamaGamesAPI.get().getAchievementManager().getAchievementByID(25).unlock(uuid);
        Arrays.asList(26, 27, 28, 29).forEach(id -> SamaGamesAPI.get().getAchievementManager().incrementAchievement(uuid, id, 1));
    }
    catch (Exception e)
    {
        e.printStackTrace();
        SamaGamesAPI.get().slackLog(Level.SEVERE, new SlackMessage("[" + SamaGamesAPI.get().getServerName() + "] Failed to handle '" + SamaGamesAPI.get().getUUIDTranslator().getName(uuid) + "'s win: " + e.getMessage()));
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:28,代码来源:Game.java


示例6: requestPartyJoin

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
@Override
public JoinResponse requestPartyJoin(UUID party, UUID player, JoinResponse response)
{
    if (api.getGame() != null)
    {
        Game game = api.getGame();
        //Hope for cache
        List<UUID> members = SamaGamesAPI.get().getPartiesManager().getParty(party).getPlayers();
        Pair<Boolean, String> gameResponse = game.canPartyJoinGame(members);

        if (gameResponse.getKey())
        {
            response.allow();
        } else
        {
            response.disallow(gameResponse.getValue());
            return response;
        }

        response = checkState(game, response, player);
    }

    return response;
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:25,代码来源:GameLoginHandler.java


示例7: onPlayerMove

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
/**
 * Damage player when walking on gravel if he does not have boots
 * @param event Move event
 */
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
    if (!((SurvivalGame) SamaGamesAPI.get().getGameManager().getGame()).isDamagesActivated())
        return;

    Block block = event.getTo().clone().subtract(0, 1, 0).getBlock();

    if (block != null && this.blocks.contains(block.getType())
            && (event.getPlayer().getInventory().getBoots() == null || event.getPlayer().getInventory().getBoots().getType() == Material.AIR)
            && !this.damaged.contains(event.getPlayer().getUniqueId()))
    {
        this.damaged.add(event.getPlayer().getUniqueId());
        event.getPlayer().damage((double) this.moduleConfiguration.get("damages"));

        this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> this.damaged.remove(event.getPlayer().getUniqueId()), 20L);
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:23,代码来源:PainfulStonesModule.java


示例8: win

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
/**
 * Execute win procedure
 *
 * @param player Player
 */
public void win(final Player player)
{
    SurvivalPlayer playerData = (SurvivalPlayer) this.getPlayer(player.getUniqueId());

    if (playerData != null)
    {
        playerData.addCoins(100, "Victoire ! ");

        for (Player user : this.server.getOnlinePlayers())
            Titles.sendTitle(user, 0, 60, 5, ChatColor.RED + "Fin du jeu", ChatColor.YELLOW + "Victoire de " + SamaGamesAPI.get().getPlayerManager().getPlayerData(player.getUniqueId()).getDisplayName());

        this.coherenceMachine.getTemplateManager().getPlayerWinTemplate().execute(player);

        this.handleWinner(player.getUniqueId());
        this.effectsOnWinner(player);
    }

    this.handleGameEnd();
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:25,代码来源:SurvivalSoloGame.java


示例9: remove

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
public void remove(boolean got)
{
    this.entityTitle.remove();
    this.entityItem.remove();
    this.entityBase.remove();

    Color fwColor = got ? Color.BLUE : Color.RED;

    Firework fw = this.location.getWorld().spawn(this.location.clone().add(0.5, 1, 0.5), Firework.class);
    FireworkMeta fwm = fw.getFireworkMeta();
    FireworkEffect effect = FireworkEffect.builder().withColor(fwColor).with(this.parent.isSpecial() ? FireworkEffect.Type.STAR : FireworkEffect.Type.BALL).build();

    fwm.addEffects(effect);
    fwm.setPower(0);

    fw.setFireworkMeta(fwm);

    Bukkit.getScheduler().runTaskLater(SamaGamesAPI.get().getPlugin(), fw::detonate, 1L);

    this.particlesTask.cancel();

    this.alive = false;
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:24,代码来源:ActivePowerup.java


示例10: AgarGame

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
public AgarGame(GameType type) {
    super("agarmc", AgarMC.NAME, type.getDisplayName(), CPlayer.class);
    gameType = type;
    try
    {
        IGameProperties config = SamaGamesAPI.get().getGameManager().getGameProperties();
        origin = Utils.getLocation(config.getOption("origin", null));
        dimensions = config.getOption("dimensions", null).getAsInt();
        maxstatic = dimensions * dimensions / 24;
        maxvirus = dimensions * dimensions / 1000;
        maxcells = 16;
        Bukkit.getLogger().info("Arena : Origin = " + origin.toString() + ", Dimensions = " + dimensions);
    }
    catch(Exception e)
    {
        Bukkit.getLogger().severe("Error in game.json ! Stopping server !");
        e.printStackTrace();
        Bukkit.shutdown();
    }
}
 
开发者ID:SamaGames,项目名称:AgarMC,代码行数:21,代码来源:AgarGame.java


示例11: checkActionMessageUpdaterRunningState

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
/**
 * Checks if the task sending the permanent actions message needs to run and is not
 * running, or is useless and running. Stops or launches the task if needed.
 */
private static void checkActionMessageUpdaterRunningState()
{
	int messagesCount = actionMessages.size();

	if(messagesCount == 0 && actionMessagesUpdaterRunning)
	{
		actionMessagesUpdaterTask.cancel();
		actionMessagesUpdaterTask = null;
		actionMessagesUpdaterRunning = false;
	}
	else if(messagesCount > 0 && !actionMessagesUpdaterRunning)
	{
		actionMessagesUpdaterTask = Bukkit.getScheduler().runTaskTimer(SamaGamesAPI.get().getPlugin(), actionMessagesUpdater, 2l, 30l);
		actionMessagesUpdaterRunning = true;
	}
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:21,代码来源:ActionBarAPI.java


示例12: publish

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
private static void publish(int id, String string)
{
    Jedis jedis = null;
    try
    {
        jedis = SamaGamesAPI.get().getBungeeResource();
        if (jedis != null)
            jedis.publish("tsbot", SamaGamesAPI.get().getServerName() + "/" + id + ":" + string);
    }
    catch (Exception exception)
    {
        SamaGamesAPI.get().getPlugin().getLogger().log(Level.SEVERE, "Jedis error", exception);
    }
    finally
    {
        if (jedis != null)
            jedis.close();
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:20,代码来源:TeamSpeakAPI.java


示例13: onEnable

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
/**
 * Called on when plugin enables
 */
@Override
public void onEnable()
{
    this.worldLoader = new WorldLoader(this, SamaGamesAPI.get().getGameManager().getGameProperties().getGameOption("size", new JsonPrimitive(1000)).getAsInt());
    this.api = new SurvivalAPI(this);

    try
    {
        NMSPatcher nmsPatcher = new NMSPatcher(this);
        nmsPatcher.patchBiomes();
        nmsPatcher.patchPotions();

        if (SamaGamesAPI.get().getGameManager().getGameProperties().getGameOption("patch-stackable", new JsonPrimitive(false)).getAsBoolean())
            nmsPatcher.patchStackable();
    }
    catch (Exception e)
    {
        this.getLogger().log(Level.SEVERE, "Error while patching NMS" , e);
    }

    this.getCommand("uhc").setExecutor(new CommandUHC());
    this.getCommand("nextevent").setExecutor(new CommandNextEvent());

    this.startTimer = this.getServer().getScheduler().runTaskTimer(this, this::postInit, 20L, 20L);
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:29,代码来源:SurvivalPlugin.java


示例14: getPlayerPearls

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
public List<Pearl> getPlayerPearls(UUID player)
{
    List<Pearl> pearls = new ArrayList<>();
    Jedis jedis = SamaGamesAPI.get().getBungeeResource();

    if (jedis == null)
        return pearls;

    for (String key : jedis.keys("pearls:" + player.toString() + ":*"))
        pearls.add(new Gson().fromJson(jedis.get(key), Pearl.class));

    jedis.close();

    Collections.sort(pearls, (o1, o2) -> o1.getStars() - o2.getStars());

    return pearls;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:18,代码来源:GraouManager.java


示例15: sendPacket

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
public void sendPacket(String channel, Packet data)
{
    int id = this.packetId(data);

    if (id < 0)
    {
        this.log(Level.SEVERE, "Bad packet ID: " + id);
        return;
    }
    else if (channel == null)
    {
        this.log(Level.SEVERE, "Channel null !");
        return;
    }

    try
    {
        SamaGamesAPI.get().getPubSub().send(channel, id + ":" + this.gson.toJson(data));
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:25,代码来源:ConnectionManager.java


示例16: onClick

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
@Override
public void onClick(Player player, ItemStack stack, String action, ClickType clickType)
{
    if (action.equals("craft"))
    {
        if (SamaGamesAPI.get().getPlayerManager().getPlayerData(player.getUniqueId()).getPowders() >= 64)
        {
            this.hub.getGuiManager().openGui(player, new GuiWellCraft(this.hub, this.parent));
        }
        else
        {
            player.sendMessage(Well.TAG + ChatColor.RED + "Vous n'avez pas assez de poussières d'\u272F !");
        }
    }
    else if (action.equals("back"))
    {
        this.hub.getGuiManager().closeGui(player);
        this.parent.stop(player);
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:21,代码来源:GuiWell.java


示例17: handleLogin

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
@Override
public void handleLogin(Player p)
{
    super.handleLogin(p);
    p.setGameMode(GameMode.ADVENTURE);
    p.setLevel(0);
    p.setExp(0);
    p.setFoodLevel(20);
    p.setSaturation(20);

    Location spec = new Location(AgarMC.get().getWorld(), origin.getX() + dimensions / 2, origin.getY() + 20, origin.getZ() + dimensions / 2);
    spec.setPitch(90);
    p.teleport(spec);
    p.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1));
    if (gamePlayers.size() >= SamaGamesAPI.get().getGameManager().getGameProperties().getMaxSlots())
        this.status = Status.IN_GAME;
    Titles.sendTabTitle(p, ChatColor.GREEN + "Bienvenue sur " + ChatColor.AQUA + "SamaGames" + ChatColor.GREEN + " !\n",
            ChatColor.AQUA + "\nTeamSpeak : " + ChatColor.GREEN + "ts.samagames.net");
}
 
开发者ID:SamaGames,项目名称:AgarMC,代码行数:20,代码来源:AgarGame.java


示例18: onClick

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
@Override
public void onClick(Player player, ItemStack stack, String action)
{
    if (action.startsWith("category_"))
    {
        int id = Integer.parseInt(action.substring(9));
        this.hub.getGuiManager().openGui(player, new GuiAchievements(this.hub, SamaGamesAPI.get().getAchievementManager().getAchievementCategoryByID(id), 0));
    }
    else if (action.equals("page_back"))
    {
        this.hub.getGuiManager().openGui(player, new GuiAchievements(this.hub, this.category, this.page - 1));
    }
    else if (action.equals("page_next"))
    {
        this.hub.getGuiManager().openGui(player, new GuiAchievements(this.hub, this.category, this.page + 1));
    }
    else if (action.equals("back"))
    {
        this.hub.getGuiManager().openGui(player, this.category == null ? new GuiProfile(this.hub) : new GuiAchievements(this.hub, this.category.getParent(), 0));
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:22,代码来源:GuiAchievements.java


示例19: ShopImprovableItem

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
public ShopImprovableItem(Hub hub, String categoryName, int storageId, int slot, Integer defaultStorageId) throws Exception
{
    super(hub, categoryName, storageId, slot, new int[0]);

    this.levels = new ArrayList<>();

    if (defaultStorageId != null)
    {
        IItemDescription defaultItemDescription = SamaGamesAPI.get().getShopsManager().getItemDescription(defaultStorageId);
        this.defaultDescription = defaultItemDescription.getItemDesc();
    }
    else
    {
        this.defaultDescription = null;
    }
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:17,代码来源:ShopImprovableItem.java


示例20: updateHiders

import net.samagames.api.SamaGamesAPI; //导入依赖的package包/类
private void updateHiders(Player newConnected)
{
    this.hub.getServer().getScheduler().runTaskAsynchronously(this.hub, () ->
    {
        List<UUID> hidersUUIDList = new ArrayList<>();
        hidersUUIDList.addAll(this.hiders);

        for (UUID hiderUUID : hidersUUIDList)
        {
            Player hider = this.hub.getServer().getPlayer(hiderUUID);

            if (hider != null && !hider.equals(newConnected))
                if (!SamaGamesAPI.get().getPermissionsManager().hasPermission(newConnected, "hub.announce") && !SamaGamesAPI.get().getFriendsManager().areFriends(newConnected.getUniqueId(), hiderUUID))
                    this.hub.getServer().getScheduler().runTask(this.hub, () -> hider.hidePlayer(newConnected));
        }
    });
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:18,代码来源:PlayerManager.java



注:本文中的net.samagames.api.SamaGamesAPI类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Util类代码示例发布时间:2022-05-23
下一篇:
Java DOMForest类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap