本文整理汇总了Java中codechicken.lib.util.ServerUtils类的典型用法代码示例。如果您正苦于以下问题:Java ServerUtils类的具体用法?Java ServerUtils怎么用?Java ServerUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerUtils类属于codechicken.lib.util包,在下文中一共展示了ServerUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: tickTriangs
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public void tickTriangs() {
for (Entry<String, AddonPlayerInfo> entry : playerInfos.entrySet()) {
EntityPlayer player = ServerUtils.getPlayer(entry.getKey());
for (Integer freq : entry.getValue().triangSet) {
double spinto;
if (!RedstoneEther.server().isFreqOn(freq)) {
spinto = -1;
} else if (isRemoteOn(player, freq)) {
spinto = -2;
} else {
Vector3 strengthvec = getBroadcastVector(player, freq);
if (strengthvec == null)//in another dimension
{
spinto = -2;//spin to a random place
} else {
spinto = (player.rotationYaw + 180) * MathHelper.torad - Math.atan2(-strengthvec.x, strengthvec.z);//spin to the transmitter vec
}
}
WRServerPH.sendTriangAngleTo(player, freq, (float) spinto);
}
}
}
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:24,代码来源:RedstoneEtherServerAddons.java
示例2: onBlockActivated
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
Type type = state.getValue(TYPE);
if (type == Type.SPOT || player.isSneaking()) {
return false;
}
if (!world.isRemote) {
TileChunkLoader tile = (TileChunkLoader) world.getTileEntity(pos);
if (tile.owner == null || tile.owner.equals(player.getName()) || ChunkLoaderManager.canOpInteract() && ServerUtils.isPlayerOP(player.getName())) {
PacketCustom packet = new PacketCustom(ChunkLoaderSPH.channel, 12);
packet.writePos(pos);
packet.sendToPlayer(player);
} else {
player.sendMessage(new TextComponentTranslation("chickenchunks.accessdenied"));
}
}
return true;
}
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:20,代码来源:BlockChunkLoader.java
示例3: openItemGui
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
private void openItemGui(EntityPlayer player, ItemStack[] filters, final String string) {
ServerUtils.openSMPContainer((EntityPlayerMP) player, new ContainerItemTranslocator(new InventorySimple(filters, filterStackLimit()) {
@Override
public void markDirty() {
markUpdate();
}
}, player.inventory), (player1, windowId) -> {
PacketCustom packet = new PacketCustom(TranslocatorSPH.channel, 4);
packet.writeByte(windowId);
packet.writeShort(filterStackLimit());
packet.writeString(string);
packet.sendToPlayer(player1);
});
}
开发者ID:TheCBProject,项目名称:Translocators,代码行数:18,代码来源:TileItemTranslocator.java
示例4: isPlayerInList
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
/**
* Checks if a player is in the specified list.
*
* @param playerName The players name.
* @param list The list of players.
* @param allowCards Allows some wild cars when checking, Specifically, OP, Server Owner, and the "ALL" user.
* @return If the player is in the list.
*/
public static boolean isPlayerInList(String playerName, Set<String> list, boolean allowCards) {
if (playerName.equals("CONSOLE")) {
return list.contains(playerName);
}
playerName = playerName.toLowerCase();
if (allowCards) {
if (list.contains("ALL")) {
return true;
}
if ((ServerUtils.isPlayerOP(playerName) || ServerUtils.isPlayerOwner(playerName)) && list.contains("OP")) {
return true;
}
}
return list.contains(playerName);
}
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:27,代码来源:NEIServerConfig.java
示例5: sendNotice
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public static void sendNotice(ICommandSender sender, ITextComponent msg, String permission) {
TextComponentTranslation notice = new TextComponentTranslation("chat.type.admin", sender.getName(), msg.createCopy());
notice.getStyle().setColor(TextFormatting.GRAY).setItalic(true);
if (NEIServerConfig.canPlayerPerformAction("CONSOLE", permission)) {
ServerUtils.mc().sendMessage(notice);
}
for (EntityPlayer p : ServerUtils.getPlayers()) {
if (p == sender) {
p.sendMessage(msg);
} else if (NEIServerConfig.canPlayerPerformAction(p.getName(), permission)) {
p.sendMessage(notice);
}
}
}
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:17,代码来源:NEIServerUtils.java
示例6: findAttachedEntity
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
private void findAttachedEntity()
{
if(attachmentCounter == 0)
{
detachFromEntity();
return;
}
if(attachedPlayerName != null)
{
EntityPlayer player = ServerUtils.getPlayer(attachedPlayerName);
if(player != null)
{
attachedEntity = player;
moveToEntityExterior();
RedstoneEther.server().addTransmittingDevice(this);
attachmentCounter = 0;
return;
}
}
else
{
for(Entity entity : world.getEntitiesWithinAABBExcludingEntity(this, new AxisAlignedBB(-10, -10, -10, 10, 10, 10).offset(posX, posY, posZ)))
{
if(tryAttach(entity, 0.4, 0.2))
{
attachmentCounter = 0;
return;
}
}
attachmentCounter--;
}
}
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:35,代码来源:EntityWirelessTracker.java
示例7: setFrequencyRange
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public void setFrequencyRange(String username, int firstfreq, int lastfreq, boolean jam) {
if (!remote) {
EntityPlayer player = ServerUtils.getPlayer(username);
if (player != null)
WRServerPH.sendSetFrequencyRangeTo(player, firstfreq, lastfreq, jam);
}
if (lastfreq > numfreqs)
lastfreq = numfreqs;
boolean[] jammedFreqs = getJammedFreqs(username);
for (int settingfreq = firstfreq; settingfreq <= lastfreq; settingfreq++)
jammedFreqs[settingfreq - 1] = jam;
}
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:15,代码来源:RedstoneEther.java
示例8: unloadJammedMap
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
private void unloadJammedMap()
{
for(Iterator<String> iterator = playerJammedMap.keySet().iterator(); iterator.hasNext();)
{
String username = iterator.next();
if(ServerUtils.getPlayer(username) == null)
{
saveJammedFrequencies(username);
iterator.remove();
}
}
}
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:13,代码来源:RedstoneEtherServer.java
示例9: onWorldUnload
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (event.getWorld().isRemote) {
return;
}
RedstoneEther.unloadServerWorld(event.getWorld());
if (!ServerUtils.mc().isServerRunning()) {
RedstoneEther.unloadServer();
RedstoneEtherAddons.unloadServer();
}
}
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:14,代码来源:WREventHandler.java
示例10: chatOpsT
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public static void chatOpsT(String s, Object... params) {
for (EntityPlayerMP player : ServerUtils.getPlayers()) {
if (FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile())) {
player.addChatMessage(new TextComponentTranslation(s, params));
}
}
}
开发者ID:TheCBProject,项目名称:CodeChickenCore,代码行数:8,代码来源:CoreCommand.java
示例11: openSMPGui
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public void openSMPGui(EntityPlayer player, final String name) {
ServerUtils.openSMPContainer((EntityPlayerMP) player, new ContainerEnderItemStorage(player.inventory, this, false), (player1, windowId) -> {
PacketCustom packet = new PacketCustom(EnderStorageSPH.channel, 2);
packet.writeByte(windowId);
//packet.writeString(owner);
freq.writeToPacket(packet);
packet.writeString(name);
packet.writeByte(size);
packet.sendToPlayer(player1);
});
}
开发者ID:TheCBProject,项目名称:EnderStorage,代码行数:14,代码来源:EnderItemStorage.java
示例12: chatOpsT
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public static void chatOpsT(String s, Object... params) {
for (EntityPlayerMP player : ServerUtils.getPlayers()) {
if (FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile())) {
player.sendMessage(new TextComponentTranslation(s, params));
}
}
}
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:8,代码来源:CoreCommand.java
示例13: allowOffline
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public static boolean allowOffline(String username) {
ConfigTag config = ChickenChunks.config.getTag("allowoffline");
if (config.containsTag(username)) {
return config.getTag(username).getBooleanValue(true);
}
if (ServerUtils.isPlayerOP(username)) {
return config.getTag("OP").getBooleanValue(true);
}
return config.getTag("DEFAULT").getBooleanValue(true);
}
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:13,代码来源:ChunkLoaderManager.java
示例14: allowChunkViewer
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public static boolean allowChunkViewer(String username) {
ConfigTag config = ChickenChunks.config.getTag("allowchunkviewer");
if (config.containsTag(username)) {
return config.getTag(username).getBooleanValue(true);
}
if (ServerUtils.isPlayerOP(username)) {
return config.getTag("OP").getBooleanValue(true);
}
return config.getTag("DEFAULT").getBooleanValue(true);
}
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:13,代码来源:ChunkLoaderManager.java
示例15: updateLoginTimes
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
/**
* Ticks and saves player login times.
* Adds player Organizers to the unload Que if the logout timer has expired.
*/
private static void updateLoginTimes(World world) {
ILoginTracker tracker = PlayerLoginTracker.getTracker(world);
for (EntityPlayer player : ServerUtils.getPlayers()) {
tracker.updateLoginTime(player.getName());
}
tracker.forceSave(world);
IOrganiserStorage storage = OrganiserStorage.getStorage(world);
storage.queDormantUnloads(world);
}
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:15,代码来源:ChunkLoaderManager.java
示例16: onWorldUnload
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
@SubscribeEvent
public void onWorldUnload(Unload event) {
if (!event.getWorld().isRemote) {
if (ServerUtils.mc().isServerRunning()) {
ChunkLoaderManager.onWorldUnload(event.getWorld());
PlayerChunkViewerManager.instance().dimChanges.add(new DimensionChange((WorldServer) event.getWorld(), false));
} else {
PlayerChunkViewerManager.onServerShutdown();
ChunkLoaderManager.onServerShutdown();
}
}
}
开发者ID:TheCBProject,项目名称:ChickenChunks,代码行数:13,代码来源:ChunkLoaderEventHandler.java
示例17: load
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public static void load(World world) {
if (ServerUtils.mc() != server) {
LogHelper.debug("Loading NEI Server");
server = ServerUtils.mc();
saveDir = new File(DimensionManager.getCurrentSaveRootDirectory(), "NEI");
dimTags.clear();
loadConfig();
loadBannedItems();
}
loadWorld(world);
}
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:13,代码来源:NEIServerConfig.java
示例18: openEnchantmentGui
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
private void openEnchantmentGui(EntityPlayerMP player) {
ServerUtils.openSMPContainer(player, new ContainerEnchantmentModifier(player.inventory, player.world), (player1, windowId) -> {
PacketCustom packet = new PacketCustom(channel, 21);
packet.writeByte(windowId);
packet.sendToPlayer(player1);
});
}
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:8,代码来源:NEIServerPacketHandler.java
示例19: openPotionGui
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
private void openPotionGui(EntityPlayerMP player, PacketCustom packet) {
InventoryBasic b = new InventoryBasic("potionStore", true, 9);
for (int i = 0; i < b.getSizeInventory(); i++) {
b.setInventorySlotContents(i, packet.readItemStack());
}
ServerUtils.openSMPContainer(player, new ContainerPotionCreator(player.inventory, b), (player1, windowId) -> {
PacketCustom packet1 = new PacketCustom(channel, 24);
packet1.writeByte(windowId);
packet1.sendToPlayer(player1);
});
}
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:12,代码来源:NEIServerPacketHandler.java
示例20: PlayerSave
import codechicken.lib.util.ServerUtils; //导入依赖的package包/类
public PlayerSave(EntityPlayerMP player, File saveLocation) {
this.player = player;
wasOp = ServerUtils.mc().getPlayerList().canSendCommands(player.getGameProfile());
saveFile = new File(saveLocation, player.getName() + ".dat");
if (!saveFile.getParentFile().exists()) {
saveFile.getParentFile().mkdirs();
}
load();
}
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:11,代码来源:PlayerSave.java
注:本文中的codechicken.lib.util.ServerUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论