本文整理汇总了Java中net.canarymod.api.entity.living.humanoid.Player.isOperator方法的典型用法代码示例。如果您正苦于以下问题:Java Player.isOperator方法的具体用法?Java Player.isOperator怎么用?Java Player.isOperator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.canarymod.api.entity.living.humanoid.Player
的用法示例。
在下文中一共展示了Player.isOperator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockDestroy
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onBlockDestroy(final BlockDestroyHook hook) {
final Player player = hook.getPlayer();
final Block block = hook.getBlock();
if (!player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(block.getLocation());
if (!zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.build.name());
if (flag != null) {
final boolean excluded = zownTree.getData().getConfiguration()
.hasBlockBuildExclusion(block.getType());
if (flag) {
if (excluded) {
hook.setCanceled();
}
} else {
if (!excluded) {
hook.setCanceled();
}
}
}
}
}
}
示例2: onHangingEntityDestroy
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onHangingEntityDestroy(final HangingEntityDestroyHook hook) {
final Player player = hook.getPlayer();
final HangingEntity entity = hook.getPainting();
if (player == null || !player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(entity.getLocation());
if (player == null || !zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.build.name());
if (flag != null) {
final boolean excluded = zownTree.getData().getConfiguration()
.hasEntityCreateExclusion(entity.getClass());
if (flag) {
if (excluded) {
hook.setCanceled();
}
} else {
if (!excluded) {
hook.setCanceled();
}
}
}
}
}
}
示例3: onItemUse
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onItemUse(final ItemUseHook hook) {
final Player player = hook.getPlayer();
final Block block = hook.getBlockClicked();
if (!player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(block.getLocation());
if (!zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.build.name());
if (flag != null && !flag) {
final ItemType type = hook.getItem().getType();
if (type == ItemType.FlintAndSteel || type == ItemType.WaterBucket
|| type == ItemType.LavaBucket || type == ItemType.Bonemeal) {
hook.setCanceled();
}
}
}
}
}
示例4: onItemFrameRotate
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onItemFrameRotate(final ItemFrameRotateHook hook) {
final Player player = hook.getPlayer();
final Entity entity = hook.getItemFrame();
if (!player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(entity.getLocation());
if (!zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.interact.name());
if (flag != null) {
final boolean excluded = zownTree.getData().getConfiguration()
.hasEntityInteractExclusion(entity.getClass());
if (flag) {
if (excluded) {
hook.setCanceled();
}
} else {
if (!excluded) {
hook.setCanceled();
}
}
}
}
}
}
示例5: onItemFrameSetItem
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onItemFrameSetItem(final ItemFrameSetItemHook hook) {
final Player player = hook.getPlayer();
final Entity entity = hook.getItemFrame();
if (!player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(entity.getLocation());
if (!zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.interact.name());
if (flag != null) {
final boolean excluded = zownTree.getData().getConfiguration()
.hasEntityInteractExclusion(entity.getClass());
if (flag) {
if (excluded) {
hook.setCanceled();
}
} else {
if (!excluded) {
hook.setCanceled();
}
}
}
}
}
}
示例6: onEntityRightClick
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onEntityRightClick(final EntityRightClickHook hook) {
final Player player = hook.getPlayer();
final Entity entity = hook.getEntity();
if (!player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(entity.getLocation());
if (!zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.interact.name());
if (flag != null) {
final boolean excluded = zownTree.getData().getConfiguration()
.hasEntityInteractExclusion(entity.getClass());
if (flag) {
if (excluded) {
hook.setCanceled();
}
} else {
if (!excluded) {
hook.setCanceled();
}
}
}
}
}
}
示例7: renameZown
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@Override
public boolean renameZown(final World world, final String oldName, final String newName,
final Player player) {
boolean renamed = false;
final Map<String, Tree<Zown>> zownMap = zownMaps.get(world);
if (zownMap != null && zownMap.containsKey(oldName) && !zownMap.containsKey(newName)) {
final Tree<Zown> zownTree = zownMap.get(oldName);
if (zownTree != null
&& player == null
|| player != null
&& (player.isOperator() || player.safeHasPermission("zown.admin.manage.rename") || zownTree
.getData().isOwner(player))) {
zownMap.remove(oldName);
zownTree.getData().setName(newName);
zownMap.put(newName, zownTree);
renamed = true;
try {
dataManager.saveZown(world, zownTree, oldName);
} catch (final Exception e) {
ZownPlugin.LOG.error("Error saving zown", e);
}
}
}
return renamed;
}
示例8: onBlockPlace
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onBlockPlace(final BlockPlaceHook hook) {
final Player player = hook.getPlayer();
final Block block = hook.getBlockPlaced();
if (!player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(block.getLocation());
if (!zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.build.name());
if (flag != null) {
final boolean excluded = zownTree.getData().getConfiguration()
.hasBlockBuildExclusion(block.getType());
if (flag) {
if (excluded) {
hook.setCanceled();
ZownPlugin.LOG.info("Cancelled block place: " + flag + ":" + excluded);
}
} else {
if (!excluded) {
hook.setCanceled();
ZownPlugin.LOG.info("Cancelled block place: " + flag + ":" + excluded);
}
}
}
}
}
}
示例9: onArmorStandModify
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onArmorStandModify(final ArmorStandModifyHook hook) {
final Player player = hook.getPlayer();
// TODO need access to the armor stand being modified
// final Entity entity = hook.getArmorStand();
final Entity armorStand = player;
if (!player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(armorStand.getLocation());
if (!zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.interact.name());
if (flag != null) {
final boolean excluded = zownTree.getData().getConfiguration()
.hasEntityInteractExclusion(ArmorStand.class);
if (flag) {
if (excluded) {
hook.setCanceled();
}
} else {
if (!excluded) {
hook.setCanceled();
}
}
}
}
}
}
示例10: onPlayerCommand
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onPlayerCommand(final PlayerCommandHook hook) {
final Player player = hook.getPlayer();
final String[] command = hook.getCommand();
if (!player.isOperator()) {
final Tree<? extends IZown> zownTree = zownManager.getZown(player.getLocation());
if (zownTree.getData().getConfiguration().hasCommandRestriction(command[0])) {
hook.setCanceled();
player.message(ChatFormat.GOLD + "That command has been restricted.");
}
}
}
示例11: createZown
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@Override
public Tree<? extends IZown> createZown(final World world, final String name,
final ITemplate template, final Point p1, final Point p2, final Player player) {
Tree<Zown> zownTree = null;
Map<String, Tree<Zown>> zownMap = zownMaps.get(world);
if (zownMap == null) {
getZown(world);
zownMap = zownMaps.get(world);
}
if (!zownMap.containsKey(name)) {
final Tree<Zown> rootTree = zownTrees.get(world);
final Zown zown = new Zown(name, (Template) template, p1, p2);
if (player != null) {
zown.addOwner(player);
}
if (!intersectsExistingZown(rootTree, zown)) {
final Tree<Zown> targetTree = getTargetContainingZown(rootTree, zown);
final Boolean flag = targetTree.getData().getConfiguration()
.getFlag(Flag.playerclaim.name());
if (player == null || player.isOperator()
|| player.safeHasPermission("zown.admin.manage.create") || flag != null && flag) {
zownTree = new Tree<Zown>(zown);
targetTree.addChild(zownTree);
zownMap.put(name, zownTree);
try {
dataManager.saveZown(world, zownTree);
} catch (final Exception e) {
ZownPlugin.LOG.error("Error saving zown", e);
}
}
}
}
return zownTree;
}
示例12: removeZown
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@Override
public boolean removeZown(final World world, final String name, final Player player) {
boolean removed = false;
final Map<String, Tree<Zown>> zownMap = zownMaps.get(world);
if (zownMap != null && zownMap.containsKey(name)) {
final Tree<Zown> zownTree = zownMap.remove(name);
if (zownTree != null && player == null
|| player != null
&& (player.isOperator()
|| player.safeHasPermission("zown.admin.manage.delete")
|| (zownTree != null && zownTree.getData().isOwner(player)))) {
removed = zownTree.removeParent();
if (removed) {
for (final Tree<Zown> t : zownTree) {
zownMap.remove(t.getData().getName());
}
try {
dataManager.removeZown(world, zownTree);
} catch (final Exception e) {
ZownPlugin.LOG.error("Error saving zown", e);
}
}
}
}
return removed;
}
示例13: resizeZown
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@Override
public boolean resizeZown(final World world, final String name, final Point p1, final Point p2,
final Player player) {
boolean resized = false;
final Map<String, Tree<Zown>> zownMap = zownMaps.get(world);
if (zownMap != null) {
final Tree<Zown> zownTree = zownMap.get(name);
if (zownTree != null
&& player == null
|| player != null
&& (player.isOperator() || player.safeHasPermission("zown.admin.manage.resize") || zownTree
.getData().isOwner(player))) {
final Tree<Zown> rootTree = zownTrees.get(world);
if (!intersectsExistingZown(rootTree, p1, p2, zownTree)) {
final Tree<Zown> targetTree = getTargetContainingZown(rootTree, p1, p2, zownTree);
if (zownTree.getParent() == targetTree) {
zownTree.getData().setBounds(p1, p2);
resized = true;
try {
dataManager.saveZown(world, zownTree);
} catch (final Exception e) {
ZownPlugin.LOG.error("Error saving zown", e);
}
} else {
ZownPlugin.LOG.error("Zown being moved outside current parent");
}
} else {
ZownPlugin.LOG.error("Zown resize intersects another zown");
}
}
}
return resized;
}
示例14: broadcastMessageToOps
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@Override
public void broadcastMessageToOps(String message) {
for (Player player : this.getPlayerList()) {
if (player.isOperator()) {
player.message(message);
}
}
Canary.log.info(message);
}
示例15: onBlockRightClick
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL)
public void onBlockRightClick(final BlockRightClickHook hook) {
final Player player = hook.getPlayer();
final Block block = hook.getBlockClicked();
final Item item = player.getItemHeld();
final TileEntity tileEntity = block.getTileEntity();
final BlockType type = block.getType();
if (item == null || tileEntity != null || type == BlockType.AcaciaDoor
|| type == BlockType.AcaciaFenceGate || type == BlockType.Bed
|| type == BlockType.BirchDoor || type == BlockType.BirchFenceGate
|| type == BlockType.Cake || type == BlockType.Cauldron || type == BlockType.DarkOakDoor
|| type == BlockType.DarkOakFenceGate || type == BlockType.EndPortalFrame
|| type == BlockType.Farmland || type == BlockType.FenceGate || type == BlockType.Flowerpot
|| type == BlockType.JungleDoor || type == BlockType.JungleFenceGate
|| type == BlockType.Lever || type == BlockType.MobSpawner || type == BlockType.OakDoor
|| type == BlockType.RedstoneRepeaterOff || type == BlockType.RedstoneRepeaterOn
|| type == BlockType.SpruceDoor || type == BlockType.SpruceFenceGate
|| type == BlockType.StoneButton || type == BlockType.Trapdoor
|| type == BlockType.WoodenButton || type == BlockType.WoodenDoor) {
if (!player.isOperator() && !player.safeHasPermission("zown.admin.mod")) {
final Tree<? extends IZown> zownTree = zownManager.getZown(block.getLocation());
if (!zownTree.getData().isOwnerOrMember(player)) {
final Boolean flag = zownTree.getData().getConfiguration().getFlag(Flag.interact.name());
if (flag != null) {
final boolean excluded = zownTree.getData().getConfiguration()
.hasBlockInteractExclusion(block.getType());
if (flag) {
if (excluded) {
hook.setCanceled();
closeDoor(block);
}
} else {
if (!excluded) {
hook.setCanceled();
closeDoor(block);
}
}
}
}
}
}
}