本文整理汇总了Java中com.intellectualcrafters.plot.object.PlotPlayer类的典型用法代码示例。如果您正苦于以下问题:Java PlotPlayer类的具体用法?Java PlotPlayer怎么用?Java PlotPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlotPlayer类属于com.intellectualcrafters.plot.object包,在下文中一共展示了PlotPlayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
final Location ploc = plr.getLocation();
if (!PlotSquared.isPlotWorld(ploc.getWorld())) {
MainUtil.sendMessage(plr, C.NOT_IN_PLOT_WORLD);
return false;
}
if (args.length == 1) {
final PlotId id = MainUtil.parseId(args[0]);
if (id == null) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
return false;
}
final Location loc = MainUtil.getPlotHome(ploc.getWorld(), id);
plr.setCompassTarget(loc);
MainUtil.sendMessage(plr, C.COMPASS_TARGET);
return true;
}
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot target <X;Z>");
return false;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:22,代码来源:Target.java
示例2: canClaim
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public static boolean canClaim(PlotPlayer player, Plot plot) {
if (plot == null) {
return false;
}
if (Settings.ENABLE_CLUSTERS) {
PlotCluster cluster = ClusterManager.getCluster(plot);
if (cluster != null) {
if (!cluster.isAdded(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.command.claim")) {
return false;
}
}
}
if (plot.owner != null) {
return false;
}
return true;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:18,代码来源:MainUtil.java
示例3: execute
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
try {
// The following won't affect world generation, as that has to be
// loaded during startup unfortunately.
PlotSquared.config.load(PlotSquared.configFile);
PlotSquared.setupConfig();
C.setupTranslations();
for (final String pw : PlotSquared.getPlotWorlds()) {
final PlotWorld plotworld = PlotSquared.getPlotWorld(pw);
plotworld.loadDefaultConfiguration(PlotSquared.config.getConfigurationSection("worlds." + pw));
}
MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);
} catch (final Exception e) {
MainUtil.sendMessage(plr, C.RELOAD_FAILED);
}
return true;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:19,代码来源:Reload.java
示例4: mergePlots
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
/**
* Merges all plots in the arraylist (with cost)
*
* @param plr
* @param world
* @param plotIds
*
* @return boolean
*/
public static boolean mergePlots(final PlotPlayer player, final String world, final ArrayList<PlotId> plotIds) {
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
if ((EconHandler.manager != null) && plotworld.USE_ECONOMY) {
final double cost = plotIds.size() * plotworld.MERGE_PRICE;
if (cost > 0d) {
if (EconHandler.manager.getMoney(player) < cost) {
MainUtil.sendMessage(player, C.CANNOT_AFFORD_MERGE, "" + cost);
return false;
}
EconHandler.manager.withdrawMoney(player, cost);
MainUtil.sendMessage(player, C.REMOVED_BALANCE, cost + "");
}
}
return MainUtil.mergePlots(world, plotIds, true);
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:25,代码来源:MainUtil.java
示例5: execute
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
@Override
public boolean execute(final PlotPlayer player, final String... args) {
if (args.length == 0) {
noArgs(player);
return false;
}
switch (args[0].toLowerCase()) {
case "titles": {
if (toggle(player, "disabletitles")) {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, args[0]);
}
else {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, args[0]);
}
return true;
}
default: {
return false;
}
}
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:22,代码来源:Toggle.java
示例6: execute
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (plr == null) {
try {
final Field fPlots = PlotSquared.class.getDeclaredField("plots");
fPlots.setAccessible(true);
fPlots.set(null, DBFunc.getPlots());
} catch (final Exception e) {
PlotSquared.log("&3==== 请无视下方报错代码 &3====");
e.printStackTrace();
PlotSquared.log("&3==== 请无视上方报错代码 &3====");
}
} else {
MainUtil.sendMessage(plr, "&6这个指令只能通过控制台使用.");
}
return true;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:18,代码来源:DebugLoadTest.java
示例7: hasPermission
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public static boolean hasPermission(final PlotPlayer player, final String perm) {
if ((player == null) || player.isOp() || player.hasPermission(ADMIN)) {
return true;
}
if (player.hasPermission(perm)) {
return true;
}
final String[] nodes = perm.split("\\.");
final StringBuilder n = new StringBuilder();
for (int i = 0; i < (nodes.length - 1); i++) {
n.append(nodes[i] + ("."));
if (player.hasPermission(n + "*")) {
return true;
}
}
return false;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:18,代码来源:Permissions.java
示例8: execute
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
@Override
public boolean execute(PlotPlayer plr, String... args) {
final String world = plr.getLocation().getWorld();
if (!PlotSquared.isPlotWorld(world)) {
return !sendMessage(plr, C.NOT_IN_PLOT_WORLD);
}
boolean enable = !(plr.getMeta("chat") != null && (Boolean) plr.getMeta("chat"));
if (args.length > 0) {
if (args[0].equalsIgnoreCase("on")) {
enable = true;
} else if (args[0].equalsIgnoreCase("off")) {
enable = false;
}
}
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
if (!enable && plotworld.PLOT_CHAT) {
return !sendMessage(plr, C.PLOT_CHAT_FORCED);
}
plr.setMeta("chat", enable);
return sendMessage(plr, enable ? C.PLOT_CHAT_ON : C.PLOT_CHAT_OFF);
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:22,代码来源:Chat.java
示例9: isAlias
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
private Plot isAlias(final String world, String a) {
int index = 0;
if (a.contains(";")) {
final String[] split = a.split(";");
if ((split[1].length() > 0) && StringUtils.isNumeric(split[1])) {
index = Integer.parseInt(split[1]);
}
a = split[0];
}
final PlotPlayer player = UUIDHandler.getPlayer(a);
if (player != null) {
final java.util.Set<Plot> plotMainPlots = PlotSquared.getPlots(world, player);
final Plot[] plots = plotMainPlots.toArray(new Plot[plotMainPlots.size()]);
if (plots.length > index) {
return plots[index];
}
return null;
}
for (final Plot p : PlotSquared.getPlots(world).values()) {
if ((p.settings.getAlias().length() > 0) && p.settings.getAlias().equalsIgnoreCase(a)) {
return p;
}
}
return null;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:26,代码来源:TP.java
示例10: execute
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
@Override
public boolean execute(final PlotPlayer plr, final String... args) {
if (PlotSquared.worldEdit == null) {
MainUtil.sendMessage(plr, "&c这个服务器没有装 WorldEdit");
return false;
}
if (Permissions.hasPermission(plr, "plots.worldedit.bypass")) {
if (WEManager.bypass.contains(plr.getName())) {
WEManager.bypass.remove(plr.getName());
MainUtil.sendMessage(plr, C.WORLDEDIT_RESTRICTED);
}
else {
WEManager.bypass.add(plr.getName());
MainUtil.sendMessage(plr, C.WORLDEDIT_UNMASKED);
}
}
return true;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:19,代码来源:WE_Anywhere.java
示例11: plotExit
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public void plotExit(final PlotPlayer pp, final Plot plot) {
Player player = ((BukkitPlayer) pp).player;
final PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
Bukkit.getPluginManager().callEvent(callEvent);
if (FlagManager.getPlotFlag(plot, "fly") != null) {
player.setAllowFlight(Bukkit.getAllowFlight());
}
if (FlagManager.getPlotFlag(plot, "gamemode") != null) {
player.setGameMode(Bukkit.getDefaultGameMode());
}
if (FlagManager.getPlotFlag(plot, "time") != null) {
player.resetPlayerTime();
}
if (FlagManager.getPlotFlag(plot, "weather") != null) {
player.resetPlayerWeather();
}
if (FlagManager.getPlotFlag(plot, "music") != null) {
Location center = MainUtil.getPlotCenter(plot);
for (int i = 0; i < 256; i+= 16) {
org.bukkit.Location newLoc = BukkitUtil.getLocation(center);
newLoc.setY(i);
player.playEffect(newLoc, Effect.RECORD_PLAY, 0);
}
}
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:26,代码来源:PlotListener.java
示例12: regenerateChunk
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
@Override
public void regenerateChunk(String world, ChunkLoc loc) {
World worldObj = Bukkit.getWorld(world);
// Chunk chunk = worldObj.getChunkAt(loc.x, loc.z);
worldObj.regenerateChunk(loc.x, loc.z);
for (final Player player : worldObj.getPlayers()) {
org.bukkit.Location locObj = player.getLocation();
if (locObj.getBlockX() >> 4 == loc.x && locObj.getBlockZ() >> 4 == loc.z && !locObj.getBlock().isEmpty()) {
final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(locObj));
if (plot != null) {
final PlotPlayer pp = BukkitUtil.getPlayer(player);
pp.teleport(MainUtil.getDefaultHome(plot));
}
}
}
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:17,代码来源:BukkitChunkManager.java
示例13: onLeave
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
@EventHandler(priority= EventPriority.MONITOR)
public void onLeave(final PlayerQuitEvent event) {
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
ExpireManager.dates.put(pp.getUUID(), System.currentTimeMillis());
EventUtil.unregisterPlayer(pp);
if (PlotSquared.worldEdit != null) {
WEManager.bypass.remove(pp.getName());
}
if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) {
final Collection<Plot> plots = PlotSquared.getPlots(pp.getName()).values();
for (final Plot plot : plots) {
final PlotWorld plotworld = PlotSquared.getPlotWorld(plot.world);
final PlotManager manager = PlotSquared.getPlotManager(plot.world);
manager.clearPlot(plotworld, plot, true, null);
DBFunc.delete(plot.world, plot);
PlotSquared.log(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName()));
}
}
BukkitUtil.removePlayer(pp.getName());
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:21,代码来源:PlayerEvents.java
示例14: sendBlockChange
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public static void sendBlockChange(final org.bukkit.Location bloc, final Material type, final byte data) {
TaskManager.runTaskLater(new Runnable() {
@Override
public void run() {
String world = bloc.getWorld().getName();
int x = bloc.getBlockX();
int z = bloc.getBlockZ();
int distance = Bukkit.getViewDistance() * 16;
for (PlotPlayer player : UUIDHandler.players.values()) {
Location loc = player.getLocation();
if (loc.getWorld().equals(world)) {
if (16 * (Math.abs(loc.getX() - x)/16) > distance) {
continue;
}
if (16 * (Math.abs(loc.getZ() - z)/16) > distance) {
continue;
}
((BukkitPlayer) player).player.sendBlockChange(bloc, type, data);
}
}
}
}, 3);
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:24,代码来源:PlayerEvents.java
示例15: getName
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public static String getName(final UUID uuid) {
if (uuid == null) {
return null;
}
// check online
final PlotPlayer player = UUIDHandler.getPlayer(uuid);
if (player != null) {
return player.getName();
}
// check cache
final StringWrapper name = UUIDHandler.uuidMap.inverse().get(uuid);
if (name != null) {
return name.value;
}
return null;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:17,代码来源:UUIDHandler.java
示例16: PlotTrim
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public PlotTrim(PlotPlayer player, PlotArea area, String worldName, boolean deleteUnowned) {
FaweQueue tmpQueue = SetQueue.IMP.getNewQueue(worldName, true, false);
File saveFolder = tmpQueue.getSaveFolder();
this.root = new File(saveFolder.getParentFile().getParentFile(), worldName + "-Copy" + File.separator + "region");
this.originalRoot = saveFolder;
this.originalQueue = new MCAQueue(worldName, originalRoot, true);
this.queue = new MCAQueue(worldName + "-Copy", root, true);
this.area = area;
this.player = player;
this.deleteUnowned = deleteUnowned;
}
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:PlotTrim.java
示例17: sendMessageWrapped
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
/**
* \\previous\\
*
* @param plr
* @param msg Was used to wrap the chat client length (Packets out--)
*/
public static void sendMessageWrapped(final PlotPlayer plr, final String msg) {
// if (msg.length() > 65) {
// final String[] ss = wordWrap(msg, 65);
// final StringBuilder b = new StringBuilder();
// for (final String p : ss) {
// b.append(p).append(p.equals(ss[ss.length - 1]) ? "" : "\n ");
// }
// msg = b.toString();
// }
// if (msg.endsWith("\n")) {
// msg = msg.substring(0, msg.length() - 2);
// }
plr.sendMessage(msg);
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:21,代码来源:MainUtil.java
示例18: hasPermissionRange
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public static int hasPermissionRange(final PlotPlayer player, final String stub, final int range) {
if ((player == null) || player.isOp() || player.hasPermission(ADMIN)) {
return Integer.MAX_VALUE;
}
if (player.hasPermission(stub + ".*")) {
return Integer.MAX_VALUE;
}
for (int i = range; i > 0; i--) {
if (player.hasPermission(stub + "." + i)) {
return i;
}
}
return 0;
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:15,代码来源:Permissions.java
示例19: checkPermission
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public static boolean checkPermission(Player player, Location loc) {
Plot plot = api.getPlot(loc);
PlotPlayer pp = PlotPlayer.wrap(player);
plugin.debug("Plot: " + plot);
if (plot == null) {
plugin.debug("plots.admin.build.road: " + pp.hasPermission("plots.admin.build.road"));
return pp.hasPermission("plots.admin.build.road");
}
UUID uuid = pp.getUUID();
plugin.debug("plot.isAdded: " + plot.isAdded(uuid));
plugin.debug("plots.admin.build.other: " + pp.hasPermission("plots.admin.build.other"));
return plot.isAdded(uuid) || pp.hasPermission("plots.admin.build.other");
}
开发者ID:St3venAU,项目名称:ArmorStandTools,代码行数:14,代码来源:PlotSquaredHook.java
示例20: noArgs
import com.intellectualcrafters.plot.object.PlotPlayer; //导入依赖的package包/类
public void noArgs(PlotPlayer plr) {
final StringBuilder builder = new StringBuilder();
builder.append(C.SUBCOMMAND_SET_OPTIONS_HEADER.s());
if (plr != null) {
if (EconHandler.manager != null) {
builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "unowned", "unknown", "top", "<玩家名称>", "<世界名称>", "forsale",}));
}
else {
builder.append(getArgumentList(new String[] { "mine", "shared", "world", "all", "unowned", "unknown", "top", "<玩家名称>", "<世界名称>"}));
}
} else {
builder.append(getArgumentList(new String[] { "world", "all", "unowned", "unknown", "top", "<玩家名称>", "<世界名称>"}));
}
MainUtil.sendMessage(plr, builder.toString());
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:16,代码来源:list.java
注:本文中的com.intellectualcrafters.plot.object.PlotPlayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论