本文整理汇总了Java中me.ryanhamshire.GriefPrevention.GriefPrevention类的典型用法代码示例。如果您正苦于以下问题:Java GriefPrevention类的具体用法?Java GriefPrevention怎么用?Java GriefPrevention使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GriefPrevention类属于me.ryanhamshire.GriefPrevention包,在下文中一共展示了GriefPrevention类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allowMovement
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的package包/类
@Override
public boolean allowMovement(Player player, Location lastLocation)
{
Location to = player.getLocation();
if(lastLocation == null) return true;
Flag flag = this.GetFlagInstanceAtLocation(lastLocation, player);
if(flag == null) return true;
if(flag == this.GetFlagInstanceAtLocation(to, player)) return true;
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
String message = flag.parameters;
if(playerData.lastClaim != null)
{
message = message.replace("%owner%", playerData.lastClaim.getOwnerName());
}
GPFlags.sendMessage(player, TextMode.Info, message);
return true;
}
示例2: allowMovement
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的package包/类
@Override
public boolean allowMovement(Player player, Location lastLocation)
{
if(lastLocation == null) return true;
Location to = player.getLocation();
Flag flag = this.GetFlagInstanceAtLocation(to, player);
if(flag == null) return true;
if(flag == this.GetFlagInstanceAtLocation(lastLocation, player)) return true;
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
String message = flag.parameters;
if(playerData.lastClaim != null)
{
message = message.replace("%owner%", playerData.lastClaim.getOwnerName());
}
GPFlags.sendMessage(player, TextMode.Info, message);
return true;
}
示例3: allowMovement
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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;
}
示例4: inPvpCombat
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的package包/类
public boolean inPvpCombat()
{
if(this.lastPvpTimestamp == 0) return false;
long now = Calendar.getInstance().getTimeInMillis();
long elapsed = now - this.lastPvpTimestamp;
if(elapsed > GriefPrevention.instance.config_pvp_combatTimeoutSeconds * 1000) //X seconds
{
this.lastPvpTimestamp = 0;
return false;
}
return true;
}
示例5: getClaims
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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;
}
示例6: setBlock
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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;
}
示例7: attemptExpire
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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;
}
示例8: getChatType
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的package包/类
private ChatType getChatType(AsyncPlayerChatEvent e) {
GriefPrevention griefPrevention = griefPreventionHook == null ? null : griefPreventionHook.getPlugin();
DataStore dataStore = griefPrevention == null ? null : griefPrevention.dataStore;
if (e.isCancelled()) {
return ChatType.CANCELLED;
} else if (griefPrevention != null && dataStore.isSoftMuted(e.getPlayer().getUniqueId())) {
return ChatType.GRIEF_PROTECTION_SOFT_MUTE;
} else {
return ChatType.DEFAULT;
}
}
示例9: isManager
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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;
}
示例10: addPartyAccess
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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);
}
示例11: addPartyTrust
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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);
}
示例12: addPartyContainer
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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);
}
示例13: dropParty
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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);
}
示例14: griefPrevNearby
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的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;
}
示例15: greifPrevnClaim
import me.ryanhamshire.GriefPrevention.GriefPrevention; //导入依赖的package包/类
public boolean greifPrevnClaim(Location loc) {
if (wild.getConfig().getBoolean("GriefPrevention")) {
if (GriefPrevention.instance.dataStore.getClaimAt(loc, false, null) != null && checkSurroundingsClaims(loc))
return true;
else
return false;
} else
return false;
}