Java Code Examples for cn.nukkit.Player#isOp()
The following examples show how to use
cn.nukkit.Player#isOp() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockCommand.java From Jupiter with GNU General Public License v3.0 | 6 votes |
@Override public boolean onActivate(Item item, Player player) { if (!(player.isOp() && player.isCreative())) { return false; } BlockEntityCommandBlock blockEntity = this.getBlockEntity(); if (blockEntity == null) { CompoundTag nbt = new CompoundTag() .putString("id", BlockEntity.COMMAND_BLOCK) .putInt("x", this.getFloorX()) .putInt("y", this.getFloorY()) .putInt("z", this.getFloorZ()) .putInt("commandBlockMode", this.getMode()); blockEntity = new BlockEntityCommandBlock(this.level.getChunk(this.getFloorX() >> 4, this.getFloorZ() >> 4), nbt); } blockEntity.spawnTo(player); blockEntity.show(player); return true; }
Example 2
Source File: BlockCommand.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) { if (!(player.isOp() && player.isCreative())) { return false; } int f = 0; if (player instanceof Player) { double pitch = player.getPitch(); if (Math.abs(pitch) >= 45) { if (pitch < 0) { f = 4; } else { f = 5; } } else { f = player.getDirection().getHorizontalIndex(); } } int[] faces = new int[]{4, 2, 5, 3, 0, 1}; this.meta = faces[f]; this.getLevel().setBlock(block, this, true, true); CompoundTag nbt = new CompoundTag() .putString("id", BlockEntity.COMMAND_BLOCK) .putInt("x", this.getFloorX()) .putInt("y", this.getFloorY()) .putInt("z", this.getFloorZ()) .putInt("commandBlockMode", this.getMode()); new BlockEntityCommandBlock(this.level.getChunk(this.getFloorX() >> 4, this.getFloorZ() >> 4), nbt); return true; }
Example 3
Source File: NukkitContextManager.java From LuckPerms with MIT License | 5 votes |
@Override public QueryOptions formQueryOptions(Player subject, ImmutableContextSet contextSet) { QueryOptions.Builder queryOptions = this.plugin.getConfiguration().get(ConfigKeys.GLOBAL_QUERY_OPTIONS).toBuilder(); if (subject.isOp()) { queryOptions.option(OP_OPTION, true); } return queryOptions.context(contextSet).build(); }