当前位置: 首页>>代码示例>>Java>>正文


Java ProtocolLibrary.getProtocolManager方法代码示例

本文整理汇总了Java中com.comphenix.protocol.ProtocolLibrary.getProtocolManager方法的典型用法代码示例。如果您正苦于以下问题:Java ProtocolLibrary.getProtocolManager方法的具体用法?Java ProtocolLibrary.getProtocolManager怎么用?Java ProtocolLibrary.getProtocolManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.comphenix.protocol.ProtocolLibrary的用法示例。


在下文中一共展示了ProtocolLibrary.getProtocolManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ManagerHandler

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
public ManagerHandler(Plugin plugin) {
    config = new PracticeConfiguration();
    storageBackend = new StorageBackend(new DatabaseCredentials(config.getRootConfig().getConfig().getString("database.host"), config.getRootConfig().getConfig().getInt("database.port"), config.getRootConfig().getConfig().getString("database.user"), config.getRootConfig().getConfig().getString("database.pass"), config.getRootConfig().getConfig().getString("database.dbName")));
    playerManager = new PlayerManager();
    partyManager = new PartyManager();
    playtimeManager = new PlayTimeManager();
    ladderManager = new LadderManager();
    arenaManager = new ArenaManager();
    matchManager = new MatchManager();
    queueManager = new QueueManager();
    spectateManager = new SpectateManager();
    kitEditManager = new KitEditManager();
    scoreboardHandler = new ScoreboardHandler();
    protocolManager = ProtocolLibrary.getProtocolManager();
    entityHider = new EntityHider(plugin, EntityHider.Policy.BLACKLIST);
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:17,代码来源:ManagerHandler.java

示例2: onEnable

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
/**
 * @see org.bukkit.plugin.java.JavaPlugin#onEnable()
 */
@Override
public void onEnable() {
    saveDefaultConfig();
    CONFIG = new Configuration(this);
    CONFIG.reload();

    _protocolManager = ProtocolLibrary.getProtocolManager();
    _protocolManager.addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.UPDATE_TIME) {
        @Override
        public void onPacketSending(PacketEvent event) {
            if (event.getPacketType() == PacketType.Play.Server.UPDATE_TIME &&
                _ignoringTime.contains(event.getPlayer()) &&
                event.getPacket().getLongs().read(1) >= 0) {
                event.setCancelled(true);
            }
        }
    });
}
 
开发者ID:NerdNu,项目名称:NerdMoods,代码行数:22,代码来源:NerdMoods.java

示例3: reload

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
public static void reload(CommandSender sender) {
    ChatItem obj = getInstance();
    obj.pm = ProtocolLibrary.getProtocolManager();
    obj.saveDefaultConfig();
    obj.reloadConfig();
    obj.storage = new Storage(obj.getConfig());
    obj.packetListener.setStorage(obj.storage);
    obj.packetValidator.setStorage(obj.storage);
    obj.chatEventListener.setStorage(obj.storage);
    obj.filter.setStorage(obj.storage);
    APIImplementation api = (APIImplementation) Bukkit.getServicesManager().getRegistration(ChatItemAPI.class).getProvider();
    api.setStorage(obj.storage);
    api.updateLogger();
    if (!obj.storage.RELOAD_MESSAGE.isEmpty())
        sender.sendMessage(obj.storage.RELOAD_MESSAGE);
}
 
开发者ID:dadus33,项目名称:ChatItem,代码行数:17,代码来源:ChatItem.java

示例4: onEnable

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
@Override
public void onEnable() {
    this.getServer().getPluginManager().registerEvents(this, this);
    protocolManager = ProtocolLibrary.getProtocolManager();

    Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
        @Override
        public void run() {
            if (Bukkit.getOnlinePlayers().size() != 0) {
                int index = 0;
                if (Bukkit.getOnlinePlayers().size() > 1) {
                    index = random.nextInt(Bukkit.getOnlinePlayers().size() - 1);
                }
                Player[] players = Bukkit.getOnlinePlayers().toArray(new Player[Bukkit.getOnlinePlayers().size()]);
                Player p = players[index];
                checkPlayer(p, "");
            }
        }
    }, 20, 20 * 20);
    this.getCommand("sprawdz").setExecutor(this);
}
 
开发者ID:grzegorz2047,项目名称:ControlCheaters,代码行数:22,代码来源:ControlCheaters.java

示例5: sendNbt

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
private void sendNbt(Vector pos, NbtCompound compound) {
    Player player = this.<Player>getPlayer().parent;
    ProtocolManager manager = ProtocolLibrary.getProtocolManager();

    PacketContainer blockNbt = new PacketContainer(PacketType.Play.Server.TILE_ENTITY_DATA);
    blockNbt.getBlockPositionModifier().write(0, new BlockPosition(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()));
    blockNbt.getIntegers().write(0, 7);
    blockNbt.getNbtModifier().write(0, compound);


    try {
        manager.sendServerPacket(player, blockNbt);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:17,代码来源:StructureCUI.java

示例6: onEnable

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
@Override
public void onEnable() {
    configuration = new Configuration(this);
    configuration.saveDefault();
    configuration.load();

    getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
    getCommand("mmoaction").setExecutor(new ToggleCommand(this));

    //the event could and should be executed async, but if we try to use it with other sync listeners
    //the sending order gets mixed up
    ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
    protocolManager.addPacketListener(new MessageListener(this, configuration.getMessages()));

    //load disabled lists
    actionBarDisabled = loadDisabled(ACTIONBAR_FILE_NAME);
    progressBarDisabled = loadDisabled(PROGRESS_FILE_NAME);
}
 
开发者ID:games647,项目名称:mcMMOAction,代码行数:19,代码来源:mcMMOAction.java

示例7: setupPacketModification

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
/**
 * Set up packet listening for ENTITY_METADATA packets so they can be modified to actually contain
 * the dead horses' equipped armor.
 */
private void setupPacketModification() {
  if (getServer().getPluginManager().getPlugin(PROTOCOL_LIB) instanceof ProtocolLibrary) {
    fancyLog("ProtocolLib detected, creating hook for entity metadata packets.");
    ProtocolManager manager = ProtocolLibrary.getProtocolManager();
    manager.addPacketListener(new PacketAdapter(new PacketAdapter.AdapterParameteters()
        .plugin(this).serverSide().types(PacketType.Play.Server.ENTITY_METADATA)) {
      @Override
      public void onPacketSending(PacketEvent event) {
        if (config.isPacketModificationEnabled()) {
          handleMetadataPacket(event);
        }
      }
    });
    hookedProtocolLib = true;
    fancyLog("Entity metadata packet hooked.");
  }
}
 
开发者ID:EasyMFnE,项目名称:DeadHorses,代码行数:22,代码来源:DeadHorses.java

示例8: onEnable

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
@Override
public void onEnable() {
    FileConfiguration configuration = getConfig();
    configuration.options().copyDefaults(true);
    saveConfig();

    double minDistBetween = configuration.getDouble("minDistBetween");
    double maxRenderDist = configuration.getDouble("maxRenderDist");
    int tickTime = configuration.getInt("tickTime");
    int ticksToLast = configuration.getInt("ticksToLast");

    Ticker ticker = new Ticker(
            ProtocolLibrary.getProtocolManager(),
            minDistBetween,
            ticksToLast,
            maxRenderDist
    );

    ticker.runTaskTimer(this, 0, tickTime);
}
 
开发者ID:Eluinhost,项目名称:footprints-plugin,代码行数:21,代码来源:FootprintsPlugin.java

示例9: sendBlankInventoryPacket

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
public void sendBlankInventoryPacket(Player player) {
    ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
    PacketContainer inventoryPacket = protocolManager.createPacket(PacketType.Play.Server.WINDOW_ITEMS);
    inventoryPacket.getIntegers().write(0, PLAYER_INVENTORY);
    int inventorySize = CRAFTING_SIZE + ARMOR_SIZE + MAIN_SIZE + HOTBAR_SIZE;

    ItemStack[] blankInventory = new ItemStack[inventorySize];
    Arrays.fill(blankInventory, new ItemStack(Material.AIR));

    //old minecraft versions
    StructureModifier<ItemStack[]> itemArrayModifier = inventoryPacket.getItemArrayModifier();
    if (itemArrayModifier.size() > 0) {
        itemArrayModifier.write(0, blankInventory);
    } else {
        //minecraft versions above 1.11
        StructureModifier<List<ItemStack>> itemListModifier = inventoryPacket.getItemListModifier();
        itemListModifier.write(0, Arrays.asList(blankInventory));
    }

    try {
        protocolManager.sendServerPacket(player, inventoryPacket, false);
    } catch (InvocationTargetException invocationExc) {
        ConsoleLogger.logException("Error during sending blank inventory", invocationExc);
    }
}
 
开发者ID:AuthMe,项目名称:AuthMeReloaded,代码行数:26,代码来源:InventoryPacketAdapter.java

示例10: onEnable

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
@Override
public void onEnable() {
	instance = this;

	this.protocolManager = ProtocolLibrary.getProtocolManager();

	// Configuration.
	loadConfig();

	registerListeners();
	registerCommands();
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:13,代码来源:Crescent.java

示例11: registerPacketListeners

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
public void registerPacketListeners() {
	final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
	for (PacketType packetType : new PacketType[] { PacketType.Play.Client.POSITION }) {
		protocolManager
				.addPacketListener(new PacketAdapter(Crescent.getInstance(), ListenerPriority.NORMAL, packetType) {
					@Override
					public void onPacketReceiving(PacketEvent event) {
						if (event.getPacketType() == packetType) {
							Bukkit.getPluginManager()
									.callEvent(new PlayerPacketEvent(event.getPlayer(), event.getPacket()));
						}
					}
				});
	}
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:16,代码来源:BehaviourListeners.java

示例12: PacketScoreboard

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
public PacketScoreboard(@Nullable ExtendedJavaPlugin plugin) {
    this.protocolManager = ProtocolLibrary.getProtocolManager();

    if (plugin != null) {
        Events.subscribe(PlayerJoinEvent.class).handler(this::handlePlayerJoin).bindWith(plugin);
        Events.subscribe(PlayerQuitEvent.class).handler(this::handlePlayerQuit).bindWith(plugin);
    } else {
        Events.subscribe(PlayerJoinEvent.class).handler(this::handlePlayerJoin);
        Events.subscribe(PlayerQuitEvent.class).handler(this::handlePlayerQuit);
    }
}
 
开发者ID:lucko,项目名称:helper,代码行数:12,代码来源:PacketScoreboard.java

示例13: onLoad

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
public void onLoad() {
	// Spigot : config
	this.initBungeecord();
	
	// ProtocolLib
	this.protocolManager = ProtocolLibrary.getProtocolManager();
	if (this.protocolManager == null) {
		this.warn("ProtocolLib is not enabled");
		this.setEnabled(false);
		return;
	}
}
 
开发者ID:EverCraft,项目名称:SayNoToMcLeaks,代码行数:13,代码来源:BukkitSayNoToMcLeaks.java

示例14: hook

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
/**
 * Hooks ProtocolLibrary into a {@link JavaPlugin}.
 *
 * @param kairos
 *            the plugin to hook into
 */
public static void hook(HCF kairos) {
    ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
    protocolManager.addPacketListener(new PacketAdapter(kairos, ListenerPriority.NORMAL, PacketType.Play.Client.BLOCK_DIG) {
        @Override
        public void onPacketReceiving(PacketEvent event) {
            PacketContainer packet = event.getPacket();
            StructureModifier<Integer> modifier = packet.getIntegers();
            Player player = event.getPlayer();

            try {
                int status = modifier.read(4);
                // int face = modifier.read(3);
                if (status == STARTED_DIGGING || status == FINISHED_DIGGING) {
                    int x, y, z;
                    Location location = new Location(player.getWorld(), x = modifier.read(0), y = modifier.read(1), z = modifier.read(2));

                    // Validation
                    VisualBlock visualBlock = kairos.getVisualiseHandler().getVisualBlockAt(player, location);
                    if (visualBlock == null)
                        return;

                    event.setCancelled(true);
                    VisualBlockData data = visualBlock.getBlockData();
                    if (status == FINISHED_DIGGING) {
                        player.sendBlockChange(location, data.getBlockType(), data.getData());
                    } else if (status == STARTED_DIGGING) { // we check this because Blocks that broke pretty much straight away do not send a FINISHED for some weird reason.
                        EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
                        if (player.getGameMode() == GameMode.CREATIVE
                                || net.minecraft.server.v1_7_R4.Block.getById(data.getItemTypeId()).getDamage(entityPlayer, entityPlayer.world, x, y, z) > 1.0F) {

                            player.sendBlockChange(location, data.getBlockType(), data.getData());
                        }
                    }
                }
            } catch (FieldAccessException ignored) {
            }
        }
    });
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:46,代码来源:ProtocolLibHook.java

示例15: PacketListener

import com.comphenix.protocol.ProtocolLibrary; //导入方法依赖的package包/类
public PacketListener(MultiLineAPI plugin) {
    this.plugin = plugin;
    this.tagMap = Maps.newHashMap();
    ProtocolManager manager = ProtocolLibrary.getProtocolManager();
    manager.addPacketListener(this);
    PacketUtil.init(manager, plugin.getLogger(), false);
}
 
开发者ID:iso2013,项目名称:MultiLineAPI,代码行数:8,代码来源:PacketListener.java


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