当前位置: 首页>>代码示例>>Java>>正文


Java Claim类代码示例

本文整理汇总了Java中me.ryanhamshire.GriefPrevention.Claim的典型用法代码示例。如果您正苦于以下问题:Java Claim类的具体用法?Java Claim怎么用?Java Claim使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Claim类属于me.ryanhamshire.GriefPrevention包,在下文中一共展示了Claim类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: allowMovement

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
@Override
public boolean allowMovement(Player player, Location lastLocation)
{
    if(player.hasPermission("gpflags.bypass")) return true;
    
    Location to = player.getLocation();
    Location from = lastLocation;
    
    Flag flag = this.GetFlagInstanceAtLocation(to, player);
    if(flag == null) return true;
    
    if(from == null || flag == this.GetFlagInstanceAtLocation(from, player)) return true;
    
    PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
    Claim claim = GriefPrevention.instance.dataStore.getClaimAt(to, false, playerData.lastClaim);
    if(claim.allowAccess(player) != null)
    {
        GPFlags.sendMessage(player, TextMode.Err, flag.parameters);
        return false;
    }
    
    return true;
}
 
开发者ID:BigScary,项目名称:GriefPreventionFlags,代码行数:24,代码来源:FlagDef_NoEnter.java

示例2: getClaims

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
public Vector<Claim> getClaims()
{
    if(this.claims == null)
    {
        this.claims = new Vector<Claim>();
        
        //find all the claims belonging to this player and note them for future reference
        DataStore dataStore = GriefPrevention.instance.dataStore;
        for(int i = 0; i < dataStore.claims.size(); i++)
        {
            Claim claim = dataStore.claims.get(i);
            if(playerID.equals(claim.ownerID))
            {
                this.claims.add(claim);
            }
        }
    }
    
    return claims;
}
 
开发者ID:john01dav,项目名称:GriefPreventionPlus,代码行数:21,代码来源:PlayerData.java

示例3: setBlock

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
private static boolean setBlock(Location location, Player player ,
		Material material,Material mask){
	Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, true, null);
	if(claim == null){
		player.sendMessage("You can only use this tool in a claimed area.");
		return false;
	}
	String errormessage = claim.allowBuild(player);
	if(errormessage == null){	
		Block block = location.getBlock();
		if(mask == null || block.getType() == mask) 
			location.getBlock().setType(material);
	}
	else{
		player.sendMessage(errormessage);
		return false;
	}
	return true;
}
 
开发者ID:jimmy1248,项目名称:CreativeAssist,代码行数:20,代码来源:ToolMode.java

示例4: attemptExpire

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
private static boolean attemptExpire(Claim claim) {
    if (claim.isAdminClaim())
        return false; // These claims are exempt.
    ArrayList<String> preventList = new ArrayList<>();
    preventList.add(claim.ownerID.toString());
    claim.getPermissions(preventList, preventList, new ArrayList<>(), preventList); // Should all be pointed to the same list, except accessors which we ignore.
    long lastLogin = preventList.stream().map(UUID::fromString).map(Bukkit::getOfflinePlayer).mapToLong(OfflinePlayer::getLastPlayed).max().orElse(0); // Get the last login time.
    long days = TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis() - lastLogin);
    if (days < 60)
        return false;
    Core.logInfo(claim.ownerID + " expired. Days = " + days);
    GriefPrevention.instance.dataStore.deleteClaim(claim);
    return true;
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:15,代码来源:GeneralMechanics.java

示例5: isManager

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
public Result isManager(Player claimer) {
	Claim claim = GriefPrevention.instance.dataStore.getClaimAt(claimer.getLocation(), false, null);
	if (claim == null) {
		return Result.NOEXIST;
	}
	if (!claim.getOwnerName().equalsIgnoreCase(claimer.getName())) {
		if (Variables.griefprevention_needowner || !claim.managers.contains(claimer.getUniqueId().toString())) {
			return Result.NOMANAGER;
		}
	}
	return Result.SUCCESS;
}
 
开发者ID:AlessioDP,项目名称:Parties,代码行数:13,代码来源:GriefPreventionHandler.java

示例6: addPartyAccess

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
public void addPartyAccess(Player claimer, Party party) {
	Claim claim = GriefPrevention.instance.dataStore.getClaimAt(claimer.getLocation(), false, null);
	
	for (UUID uuid : party.getMembers()) {
		String name = Bukkit.getOfflinePlayer(uuid).getName() != null ? Bukkit.getOfflinePlayer(uuid).getName() : plugin.getDatabaseDispatcher().getOldPlayerName(uuid);
		if (name.equalsIgnoreCase(claimer.getName()))
			continue;
		claim.setPermission(uuid.toString(), ClaimPermission.Access);
	}
	GriefPrevention.instance.dataStore.saveClaim(claim);
}
 
开发者ID:AlessioDP,项目名称:Parties,代码行数:12,代码来源:GriefPreventionHandler.java

示例7: addPartyTrust

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
public void addPartyTrust(Player claimer, Party party) {
	Claim claim = GriefPrevention.instance.dataStore.getClaimAt(claimer.getLocation(), false, null);
	
	for (UUID uuid : party.getMembers()) {
		if (Bukkit.getOfflinePlayer(uuid).getName().equalsIgnoreCase(claimer.getName()))
			continue;
		claim.setPermission(uuid.toString(), ClaimPermission.Build);
	}
	GriefPrevention.instance.dataStore.saveClaim(claim);
}
 
开发者ID:AlessioDP,项目名称:Parties,代码行数:11,代码来源:GriefPreventionHandler.java

示例8: addPartyContainer

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
public void addPartyContainer(Player claimer, Party party) {
	Claim claim = GriefPrevention.instance.dataStore.getClaimAt(claimer.getLocation(), false, null);
	
	for (UUID uuid : party.getMembers()) {
		if (Bukkit.getOfflinePlayer(uuid).getName().equalsIgnoreCase(claimer.getName()))
			continue;
		claim.setPermission(uuid.toString(), ClaimPermission.Inventory);
	}
	GriefPrevention.instance.dataStore.saveClaim(claim);
}
 
开发者ID:AlessioDP,项目名称:Parties,代码行数:11,代码来源:GriefPreventionHandler.java

示例9: dropParty

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
public void dropParty(Player claimer, Party party) {
	Claim claim = GriefPrevention.instance.dataStore.getClaimAt(claimer.getLocation(), false, null);
	
	for (UUID uuid : party.getMembers()) {
		if (Bukkit.getOfflinePlayer(uuid).getName().equalsIgnoreCase(claimer.getName()))
			continue;
		claim.dropPermission(uuid.toString());
	}
	GriefPrevention.instance.dataStore.saveClaim(claim);
}
 
开发者ID:AlessioDP,项目名称:Parties,代码行数:11,代码来源:GriefPreventionHandler.java

示例10: griefPrevNearby

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
public boolean griefPrevNearby(Location l) {
    if (Bukkit.getServer().getPluginManager().getPlugin("GriefPrevention") == null) {
        return false;
    }
    if(!RandomCoords.getPlugin().getConfig().getString("GriefPrevention").equalsIgnoreCase("true")) {
        return false;
    }
    final GriefPrevention gp = GriefPrevention.instance;


    int radius = RandomCoords.getPlugin().getConfig().getInt("CheckingRadius");
    int chunkRadius = radius < 16 ? 1 : (radius - (radius % 16)) / 16;
    int x;
    int y;
    int z;


    for (int chX = 0 - chunkRadius; chX <= chunkRadius; chX++) {

        for (int chZ = 0 - chunkRadius; chZ <= chunkRadius; chZ++) {
            x = l.getBlockX();
            y = l.getBlockY();
            z = l.getBlockZ();
            Chunk chunk = l.getWorld().getBlockAt(x + (chX * 16), y, z + (chZ * 16)).getChunk();
            Collection<Claim> claims = gp.dataStore.getClaims(chunk.getX(), chunk.getZ());
            if(!claims.isEmpty() && claims != null) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:jolbol1,项目名称:RandomCoordinatesV2,代码行数:34,代码来源:GriefPreventionCheck.java

示例11: getClaim

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
@Nullable
Claim getClaim(final long id) {
	if (getClaim != null) {
		try {
			return (Claim) getClaim.invoke(plugin.dataStore, id);
		} catch (final IllegalAccessException e) {
			assert false : e;
		} catch (final IllegalArgumentException e) {
			assert false : e;
		} catch (final InvocationTargetException e) {
			throw new RuntimeException(e.getCause());
		}
	} else {
		assert claimsField != null;
		try {
			final List<?> claims = (List<?>) claimsField.get(plugin.dataStore);
			for (final Object claim : claims) {
				if (!(claim instanceof Claim))
					continue;
				if (((Claim) claim).getID() == id)
					return (Claim) claim;
			}
		} catch (final IllegalArgumentException e) {
			assert false : e;
		} catch (final IllegalAccessException e) {
			assert false : e;
		}
	}
	return null;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:31,代码来源:GriefPreventionHook.java

示例12: deserialize

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
@Override
public void deserialize(final Fields fields) throws StreamCorruptedException {
	final long id = fields.getPrimitive("id", long.class);
	final Claim c = getClaim(id);
	if (c == null)
		throw new StreamCorruptedException("Invalid claim " + id);
	claim = c;
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:9,代码来源:GriefPreventionHook.java

示例13: getRegionsAt_i

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
@SuppressWarnings("null")
@Override
public Collection<? extends Region> getRegionsAt_i(final Location l) {
	final Claim c = plugin.dataStore.getClaimAt(l, false, null);
	if (c != null)
		return Arrays.asList(new GriefPreventionRegion(c));
	return Collections.emptySet();
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:9,代码来源:GriefPreventionHook.java

示例14: getRegion_i

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
@Override
@Nullable
public Region getRegion_i(final World world, final String name) {
	try {
		final Claim c = getClaim(Long.parseLong(name));
		if (c != null && world.equals(c.getLesserBoundaryCorner().getWorld()))
			return new GriefPreventionRegion(c);
		return null;
	} catch (final NumberFormatException e) {
		return null;
	}
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:13,代码来源:GriefPreventionHook.java

示例15: onPlayerDeath

import me.ryanhamshire.GriefPrevention.Claim; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerDeath(PlayerDeathEvent event)
{
    Player player = event.getEntity();
    Location location = player.getLocation();
    
    Flag flag = this.GetFlagInstanceAtLocation(location, player);
    if(flag == null) return;
    
    SpleefData data = new SpleefData(flag.getParametersArray());
    PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
    Claim claim = GriefPrevention.instance.dataStore.getClaimAt(location, true, playerData.lastClaim);
    if(claim == null) return;
    
    ArrayList<Chunk> chunks = claim.getChunks();
    for(Chunk chunk : chunks)
    {
        for(int x = 0; x < 16; x++)
        {
            for(int z = 0; z < 16; z++)
            {
                for(int y = 0; y < location.getWorld().getMaxHeight() - data.differenceY; y++)
                {
                    if(claim.contains(location, true, false))
                    {
                        Block block = chunk.getBlock(x,  y,  z);
                        if(data.IsSupport(block))
                        {
                            chunk.getBlock(x, y + data.differenceY, z).setTypeIdAndData(data.blockID, data.blockData == null ? (byte)0 : (byte)(int)data.blockData, false);
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:BigScary,项目名称:GriefPreventionFlags,代码行数:38,代码来源:FlagDef_SpleefArena.java


注:本文中的me.ryanhamshire.GriefPrevention.Claim类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。