本文整理汇总了Java中com.sk89q.worldguard.domains.DefaultDomain.removePlayer方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultDomain.removePlayer方法的具体用法?Java DefaultDomain.removePlayer怎么用?Java DefaultDomain.removePlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldguard.domains.DefaultDomain
的用法示例。
在下文中一共展示了DefaultDomain.removePlayer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeMembers
import com.sk89q.worldguard.domains.DefaultDomain; //导入方法依赖的package包/类
/**
* Removes a list of members from a region.
*
* @param world World were the region is.
* @param regionName The ID of the region.
* @param playerNames Players to be added.
* @return true on succes, false on failure.
*/
public boolean removeMembers(World world, String regionName, String[] playerNames) {
RegionManager rm = wgp.getRegionManager(world);
if (rm == null) {
return false;
}
ProtectedRegion region = rm.getRegion(regionName);
if (region == null) {
return false;
}
DefaultDomain members = region.getMembers();
for (String playerName : playerNames) {
members.removePlayer(playerName);
}
region.setMembers(members);
try {
rm.save();
} catch (ProtectionDatabaseException ex) {
plugin.getLogger().log(Level.SEVERE, "Unexpected failure saving WorldGuard configuration: {0}", ex.toString());
return false;
}
return true;
}
示例2: delMemberPlayer
import com.sk89q.worldguard.domains.DefaultDomain; //导入方法依赖的package包/类
public boolean delMemberPlayer(ProtectedRegion pr, String playerName) {
boolean result = true;
DefaultDomain dd = pr.getMembers();
if (dd.contains(playerName)) {
dd.removePlayer(playerName);
} else {
result = false;
}
return result;
}
示例3: execute
import com.sk89q.worldguard.domains.DefaultDomain; //导入方法依赖的package包/类
protected void execute(Event event) {
String name = (String) this.name.getSingle(event);
World world = (World) this.world.getSingle(event);
if (world == null) {
for (RegionManager a : WGBukkit.getPlugin().getRegionContainer().getLoaded()) {
for (Entry<String, ProtectedRegion> b : a.getRegions().entrySet()) {
if (b.getKey().equals(name)) {
world = Bukkit.getWorld(a.getName());
break;
}
}
}
}
RegionManager regionManager = WGBukkit.getRegionManager(world);
if (!regionManager.hasRegion(name)) {
Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
return;
}
DefaultDomain owners = regionManager.getRegion(name).getOwners();
Object[] arrayOfObject;
int j = (arrayOfObject = this.players.getArray(event)).length;
for (int i = 0; i < j; i++) {
Object o = arrayOfObject[i];
if ((o instanceof Player)) {
if (mark == -1) {
owners.removePlayer(((Player) o).getName());
} else if (mark == 1) {
owners.removePlayer(((Player) o).getUniqueId());
} else if (mark == 0) {
owners.removePlayer(((Player) o).getName());
}
} else if ((o instanceof OfflinePlayer)) {
if (mark == -1) {
owners.removePlayer(((OfflinePlayer) o).getName());
} else if (mark == 1) {
owners.removePlayer(((OfflinePlayer) o).getUniqueId());
} else if (mark == 0) {
owners.removePlayer(((OfflinePlayer) o).getName());
}
} else {
owners.removePlayer(o.toString());
}
}
regionManager.getRegion(name).setOwners(owners);
try {
regionManager.save();
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: execute
import com.sk89q.worldguard.domains.DefaultDomain; //导入方法依赖的package包/类
protected void execute(Event event) {
String name = (String) this.name.getSingle(event);
World world = (World) this.world.getSingle(event);
if (world == null) {
for (RegionManager a : WGBukkit.getPlugin().getRegionContainer().getLoaded()) {
for (Entry<String, ProtectedRegion> b : a.getRegions().entrySet()) {
if (b.getKey().equals(name)) {
world = Bukkit.getWorld(a.getName());
break;
}
}
}
}
RegionManager regionManager = WGBukkit.getRegionManager(world);
if (!regionManager.hasRegion(name)) {
Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
return;
}
DefaultDomain members = regionManager.getRegion(name).getMembers();
Object[] arrayOfObject;
int j = (arrayOfObject = this.players.getArray(event)).length;
for (int i = 0; i < j; i++) {
Object o = arrayOfObject[i];
if ((o instanceof Player)) {
if (mark == -1) {
members.removePlayer(((Player) o).getName());
} else if (mark == 1) {
members.removePlayer(((Player) o).getUniqueId());
} else if (mark == 0) {
members.removePlayer(((Player) o).getName());
}
} else if ((o instanceof OfflinePlayer)) {
if (mark == -1) {
members.removePlayer(((OfflinePlayer) o).getName());
} else if (mark == 1) {
members.removePlayer(((OfflinePlayer) o).getUniqueId());
} else if (mark == 0) {
members.removePlayer(((OfflinePlayer) o).getName());
}
} else {
members.removePlayer(o.toString());
}
}
regionManager.getRegion(name).setMembers(members);
try {
regionManager.save();
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: removeOwner
import com.sk89q.worldguard.domains.DefaultDomain; //导入方法依赖的package包/类
public static void removeOwner(OfflinePlayer p, ProtectedRegion r){
DefaultDomain owners = r.getOwners();
owners.removePlayer(p.getUniqueId());
r.setOwners(owners);
}
示例6: removeMember
import com.sk89q.worldguard.domains.DefaultDomain; //导入方法依赖的package包/类
public static void removeMember(UUID id, ProtectedRegion r){
DefaultDomain members = r.getMembers();
members.removePlayer(id);
r.setMembers(members);
}