本文整理汇总了Java中org.cubeengine.butler.parametric.Default类的典型用法代码示例。如果您正苦于以下问题:Java Default类的具体用法?Java Default怎么用?Java Default使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Default类属于org.cubeengine.butler.parametric包,在下文中一共展示了Default类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tppos
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Direct teleport to a coordinate.")
public void tppos(CommandSource context, Integer x, Integer y, Integer z, // TODO optional y coord
@Default @Named({"world", "w"}) World world,
@Default @Named({"player", "p"}) Player player,
@Flag boolean unsafe)
{
Location<World> loc = new Location<>(world, x, y, z).add(0.5, 0, 0.5);
unsafe = unsafe && context.hasPermission(module.perms().COMMAND_TPPOS_UNSAFE.getId());
if (unsafe)
{
player.setLocation(loc);
}
else if (!player.setLocationSafely(loc))
{
i18n.send(context, NEGATIVE, "Unsafe Target!");
return;
}
i18n.send(context, POSITIVE, "Teleported to {vector:x\\=:y\\=:z\\=} in {world}!", new Vector3i(x, y, z), world);
}
示例2: swap
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Swaps you and another players position")
public void swap(CommandSource context, Player player, @Default @Label("player") Player sender)
{
if (player.equals(context))
{
if (context instanceof Player)
{
i18n.send(context, NEGATIVE, "Swapping positions with yourself!? Are you kidding me?");
return;
}
i18n.send(context, NEUTRAL, "Truly a hero! Trying to swap a users position with himself...");
return;
}
Location<World> userLoc = player.getLocation();
player.setLocation(sender.getLocation());
sender.setLocation(userLoc);
if (!context.equals(sender))
{
i18n.send(context, POSITIVE, "Swapped position of {user} and {user}!", player, sender);
return;
}
i18n.send(context, POSITIVE, "Swapped position with {user}!", player);
}
示例3: setSpawn
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Changes the global respawnpoint")
public void setSpawn(CommandSource context, @Default World world, @Optional Integer x, @Optional Integer y, @Optional Integer z)
{
Vector3d direction = null;
if (z == null)
{
if (!(context instanceof Player))
{
throw new TooFewArgumentsException();
}
final Location loc = ((Player)context).getLocation();
x = loc.getBlockX();
y = loc.getBlockY();
z = loc.getBlockZ();
direction = ((Player)context).getRotation();
}
//em.fireEvent(new WorldSetSpawnEvent(this.module, world, new Location<>(world, x, y, z), direction, context));
world.getProperties().setSpawnPosition(new Vector3i(x, y, z));
i18n.send(context, POSITIVE, "The spawn in {world} is now set to {vector:x\\=:y\\=:z\\=}", world, new Vector3i(x, y, z));
}
示例4: spawn
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Teleports a player to spawn")
public void spawn(CommandSource context, @Default Player player, @Optional World world, @Flag boolean force)
{
// TODO if OptionSubjects available => per role spawn?
world = world == null ? module.getConfig().getMainWorld() : world;
if (world == null)
{
world = player.getWorld();
}
force = force && context.hasPermission(module.perms().CMD_SPAWN_FORCE.getId()) || context.equals( player);
if (!force && player.hasPermission(module.perms().CMD_SPAWN_PREVENT.getId()))
{
i18n.send(context, NEGATIVE, "You are not allowed to spawn {user}!", player);
return;
}
final Location<World> spawnLocation = world.getSpawnLocation().add(0.5, 0, 0.5);
Vector3d rotation = player.getRotation();
player.setLocation(spawnLocation);
player.setRotation(rotation);
i18n.send(context, POSITIVE, "You are now standing at the spawn in {world}!", world);
}
示例5: balance
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Alias(value = "bbalance")
@Command(desc = "Shows the balance of the specified bank")
public void balance(CommandSource context, @Default BaseAccount.Virtual bank)
{
Map<Currency, BigDecimal> balances = bank.getBalances(context.getActiveContexts());
if (balances.isEmpty())
{
i18n.send(context, NEGATIVE, "No Balance for bank {account} found!", bank);
return;
}
i18n.send(context, POSITIVE, "Bank {account} Balance:", bank);
for (Map.Entry<Currency, BigDecimal> entry : balances.entrySet())
{
context.sendMessage(Text.of(" - ", GOLD, entry.getKey().format(entry.getValue())));
}
}
示例6: listaccess
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Lists the access levels for a bank")
public void listaccess(CommandSource context, @Default BaseAccount.Virtual bank)
{
i18n.send(context, POSITIVE, "Access Levels for {account}:", bank);
// TODO global access levels
// Everyone can SEE(hidden) DEPOSIT(needInvite)
// Noone can ...
for (Subject subject : Sponge.getServiceManager().provideUnchecked(PermissionService.class).getUserSubjects().getLoadedSubjects())
{
Optional<String> option = subject.getOption(bank.getActiveContexts(), "conomy.bank.access-level." + bank.getIdentifier());
if (option.isPresent())
{
// TODO list players highlight granted access
// <player> SEE DEPOSIT WITHDRAW MANAGE
}
}
}
示例7: balance
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Alias(value = {"balance", "moneybalance", "pmoney"})
@Command(desc = "Shows your balance")
public void balance(CommandSource context, @Default BaseAccount.Unique account)
{
Map<Currency, BigDecimal> balances = account.getBalances();
if (balances.isEmpty())
{
i18n.send(context, NEGATIVE, "No Balance for {account} found!", account);
return;
}
i18n.send(context, POSITIVE, "{account}'s Balance:", account);
for (Map.Entry<Currency, BigDecimal> entry : balances.entrySet())
{
context.sendMessage(Text.of(GOLD, entry.getKey().format(entry.getValue())));
}
}
示例8: location
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Changes a portals location")
@Restricted(value = Player.class, msg = "You have to be ingame to do this!")
public void location(Player context, @Default Portal portal)
{
if (!(selector.getSelection(context) instanceof Cuboid))
{
i18n.send(context, NEGATIVE, "Please select a cuboid first!");
return;
}
this.module.removePortal(portal);
Location<World> p1 = selector.getFirstPoint(context);
Location<World> p2 = selector.getSecondPoint(context);
portal.config.world = new ConfigWorld(p1.getExtent());
portal.config.location.from = new Vector3i(p1.getBlockX(), p1.getBlockY(), p1.getBlockZ());
portal.config.location.to = new Vector3i(p2.getBlockX(), p2.getBlockY(), p2.getBlockZ());
portal.config.save();
this.module.addPortal(portal);
i18n.send(context, POSITIVE, "Portal {name} updated to your current selection!", portal.getName());
}
示例9: clearinventory
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(alias = {"ci", "clear"}, desc = "Clears the inventory")
public void clearinventory(CommandSource context, @Default User player,
@Flag(longName = "removeArmor", name = "ra") boolean removeArmor,
@ParameterPermission(value = "quiet", desc = "Prevents the other player being notified when his inventory got cleared")
@Flag boolean quiet,
@Flag boolean force)
{
//sender.sendTranslated(NEGATIVE, "That awkward moment when you realize you do not have an inventory!");
boolean self = context.getIdentifier().equals(player.getIdentifier());
if (!self)
{
if (!context.hasPermission(COMMAND_CLEARINVENTORY_OTHER.getId()))
{
throw new PermissionDeniedException(COMMAND_CLEARINVENTORY_OTHER);
}
if (player.hasPermission(COMMAND_CLEARINVENTORY_PREVENT.getId())
&& !(force && context.hasPermission(COMMAND_CLEARINVENTORY_FORCE.getId())))
{
i18n.send(context, NEGATIVE, "You are not allowed to clear the inventory of {user}", player);
return;
}
}
player.getInventory().query(QueryOperationTypes.INVENTORY_TYPE.of(InventoryRow.class)).clear();
if (removeArmor)
{
player.getInventory().query(QueryOperationTypes.INVENTORY_TYPE.of(EquipmentInventory.class)).clear();
}
if (self)
{
i18n.send(context, POSITIVE, "Your inventory has been cleared!");
return;
}
if (player.isOnline() && player.hasPermission(COMMAND_CLEARINVENTORY_NOTIFY.getId()) && !quiet)
{
i18n.send(player.getPlayer().get(), NEUTRAL, "Your inventory has been cleared by {sender}!", context);
}
i18n.send(context, POSITIVE, "The inventory of {user} has been cleared!", player);
}
示例10: setCenter
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Sets the center for the worldborder", alias = "center")
public void setCenter(CommandSource context, @Optional Integer x, @Optional Integer z, @Default @Named("in") World world)
{
if (x == null || z == null)
{
if (context instanceof Player && x == null && z == null)
{
Vector3d position = ((Player)context).getLocation().getPosition();
x = position.getFloorX();
z = position.getFloorZ();
}
else
{
throw new TooFewArgumentsException();
}
}
world.getWorldBorder().setCenter(x + 0.5, z + 0.5);
i18n.send(context, POSITIVE, "Set world border of {world} center to {}:{}", world, x, z);
}
示例11: setDiameter
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Sets the diameter of the worldborder", alias = "set")
public void setDiameter(CommandSource context, Integer size, @Optional Integer seconds, @Default @Named("in") World world)
{
if (seconds == null)
{
world.getWorldBorder().setDiameter(size);
i18n.send(context, POSITIVE, "Set world border of {world} to {} blocks wide", world, size);
}
else
{
int prevDiameter = (int) world.getWorldBorder().getDiameter();
world.getWorldBorder().setDiameter(size, seconds * 1000);
if (size < prevDiameter)
{
i18n.send(context, POSITIVE, "Shrinking world border of {world} to {} blocks wide from {} over {} seconds",
world, size, prevDiameter, seconds);
}
else
{
i18n.send(context, POSITIVE, "Growing world border of {world} to {} blocks wide from {} over {} seconds",
world, size, prevDiameter, seconds);
}
}
}
示例12: info
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Command(desc = "Shows information about the world border", alias = "get")
public void info(CommandSource context, @Default World world)
{
WorldBorder border = world.getWorldBorder();
double diameter = border.getDiameter();
i18n.send(context, POSITIVE, "The world border in {world} is currently {} blocks wide", world,
diameter);
long secondsRemaining = border.getTimeRemaining() / 1000;
if (secondsRemaining != 0)
{
double newDiameter = border.getNewDiameter();
if (newDiameter < diameter)
{
i18n.send(context, POSITIVE, "Currently shrinking to {} blocks wide over {} seconds",
newDiameter, secondsRemaining);
}
else
{
i18n.send(context, POSITIVE, "Currently growing to {} blocks wide over {} seconds",
newDiameter, secondsRemaining);
}
}
i18n.send(context, POSITIVE, "Warnings will show within {} seconds or {} blocks from the border", border.getWarningTime(), border.getWarningDistance());
i18n.send(context, POSITIVE, "When more than {} blocks outside the border players will take {} damage per block per second", border.getDamageThreshold(), border.getDamageAmount());
}
示例13: fill
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Override
public void fill(Parameter parameter, Type type, Annotation[] annotations)
{
for (Annotation annotation : annotations)
{
if (annotation instanceof Default)
{
Class value = ((Default)annotation).value();
if (value == DefaultValue.class)
{
value = parameter.getProperty(Properties.TYPE);
}
parameter.offer(Properties.DEFAULT_PROVIDER, value);
return;
}
}
}
示例14: move
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Restricted(value = Player.class, msg = "I am calling the moving company right now!")
@Command(alias = "replace", desc = "Move a home")
public void move(Player sender, @Complete(HomeCompleter.class) @Optional String name, @Default User owner)
{
name = name == null ? "home" : name;
Home home = this.manager.get(owner, name).orElse(null);
if (home == null)
{
homeNotFoundMessage(sender, owner, name);
i18n.send(sender, NEUTRAL, "Use {text:/sethome} to set your home"); // TODO create on click
return;
}
if (!home.isOwner(sender) && !sender.hasPermission(module.getPermissions().HOME_MOVE_OTHER.getId()))
{
throw new PermissionDeniedException(module.getPermissions().HOME_MOVE_OTHER);
}
home.setTransform(sender.getTransform());
manager.save();
if (home.owner.equals(sender.getUniqueId()))
{
i18n.send(sender, POSITIVE, "Your home {name} has been moved to your current location!", home.name);
return;
}
i18n.send(sender, POSITIVE, "The home {name} of {user} has been moved to your current location", home.name, owner);
}
示例15: remove
import org.cubeengine.butler.parametric.Default; //导入依赖的package包/类
@Alias(value = {"remhome", "removehome", "delhome", "deletehome"})
@Command(alias = {"delete", "rem", "del"}, desc = "Remove a home")
public void remove(CommandSource sender, @Complete(HomeCompleter.class) @Optional String name, @Default @Optional Player owner)
{
name = name == null ? "home" : name;
Home home = this.manager.get(owner, name).orElse(null);
if (home == null)
{
homeNotFoundMessage(sender, owner, name);
return;
}
if (!sender.equals(home.getOwner().getPlayer().orElse(null)) && !sender.hasPermission(module.getPermissions().HOME_REMOVE_OTHER.getId()))
{
throw new PermissionDeniedException(module.getPermissions().HOME_REMOVE_OTHER);
}
this.manager.delete(home);
if (owner.equals(sender))
{
i18n.send(sender, POSITIVE, "Your home {name} has been removed!", name);
return;
}
i18n.send(sender, POSITIVE, "The home {name} of {user} has been removed", name, owner);
}