本文整理汇总了Java中com.bekvon.bukkit.residence.Residence类的典型用法代码示例。如果您正苦于以下问题:Java Residence类的具体用法?Java Residence怎么用?Java Residence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Residence类属于com.bekvon.bukkit.residence包,在下文中一共展示了Residence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isChunkProtected
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
/**
* Checks if there is a residence claim within the radius from location.
* Due to the way residence works, Im going to check each corner of the chunk
* instead of every block. This means it may not be 100% effective but the odds
* of a claim bein small enough to avoid each corner is high.
* @return
*/
public boolean isChunkProtected(Location location)
{
if(Bukkit.getServer().getPluginManager().getPlugin("Residence") == null) {
return false;
}
if(!RandomCoords.getPlugin().getConfig().getString("Residence").equalsIgnoreCase("true")) {
return false;
}
for (ClaimedResidence residence : Residence.getInstance().getResidenceManager().getResidences().values()) {
if ((!residence.isSubzone()) && (location.getWorld().getName().equals(residence.getWorld()))) {
for (CuboidArea area : residence.getAreaMap().values()) {
if(isInside(location, area.getHighLoc(), area.getLowLoc())) {
return true;
}
}
}
}
return false;
}
示例2: onMessage
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@Override
public B01ResTokenConfirmation onMessage(B01ResTokenConfirmation message, Player source) {
if (message.useToken && source.getItemInHand().getType() == Material.getMaterial("ALMURA_CURRENCYRESTOKEN")) {
ClaimedResidence res = Residence.getResidenceManager().getByLoc(source.getLocation());
if (res == null) {
source.sendMessage("[" + ChatColor.DARK_AQUA + "Residence" + ChatColor.WHITE + "] - There is no residence at this location.");
} else {
if (Residence.getLeaseManager().leaseExpires(res.getName())) {
Residence.getLeaseManager().removeExpireTime(res.getName());
Bukkit.getLogger().info("[Res Tokens] - Player: " + source.getName() + " / " + source.getDisplayName() + " has attempted to use a res token at: " + source.getLocation());
source.sendMessage("[" + ChatColor.DARK_AQUA + "Residence" + ChatColor.WHITE + "] - Lease Removed.");
if (source.getItemInHand().getAmount() == 1) {
source.setItemInHand(new ItemStack(Material.AIR));
} else {
source.getItemInHand().setAmount(source.getItemInHand().getAmount()-1);
}
} else {
source.sendMessage("[" + ChatColor.DARK_AQUA + "Residence" + ChatColor.WHITE + "] - There is no lease on the current residence.");
}
}
}
// TODO Just return null for now. Bridge may send return messages in the future.
return null;
}
示例3: onPlayerChangedWorld
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerChangedWorld(final PlayerChangedWorldEvent event) {
Bukkit.getScheduler().scheduleAsyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
@Override
public void run() {
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
ServerWorldUtil.sendResidenceInfo(event.getPlayer(), res);
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
ServerWorldUtil.sendAdditionalWorldInfo(player, player.getWorld().getName(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
TitleUtil.sendDisplayName(player, event.getPlayer().getName(), ChatColor.stripColor(event.getPlayer().getDisplayName()) + "\n" + TitleUtil.getCustomTitle(event.getPlayer()));
TitleUtil.sendDisplayName(event.getPlayer(), player.getName(), ChatColor.stripColor(player.getDisplayName()) + "\n" + TitleUtil.getCustomTitle(player));
}
}
}, 20L);
}
示例4: onPlayerJoin
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(final PlayerJoinEvent event) {
event.setJoinMessage("");
Bukkit.getScheduler().scheduleAsyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
@Override
public void run() {
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
ServerWorldUtil.sendResidenceInfo(event.getPlayer(), res);
// Broadcast Login
TitleUtil.broadcastLogin(event.getPlayer());
// Send Title
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
ServerWorldUtil.sendAdditionalWorldInfo(player, player.getWorld().getName(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
TitleUtil.sendDisplayName(player, event.getPlayer().getName(), ChatColor.stripColor(event.getPlayer().getDisplayName()) + "\n" + TitleUtil.getCustomTitle(event.getPlayer()));
TitleUtil.sendDisplayName(event.getPlayer(), player.getName(), ChatColor.stripColor(player.getDisplayName()) + "\n" + TitleUtil.getCustomTitle(player));
}
}
}, 30L);
TitleUtil.sendClientDetailsRequest(event.getPlayer());
EconUtil.sendCurrencyAmount(event.getPlayer(), EconUtil.economy.getBalance(event.getPlayer().getName()));
}
示例5: onPlayerRespawn
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerRespawn(final PlayerRespawnEvent event) {
Bukkit.getScheduler().scheduleSyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
@Override
public void run() {
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
ServerWorldUtil.sendResidenceInfo(event.getPlayer(), res);
// Send Title
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
ServerWorldUtil.sendAdditionalWorldInfo(player, player.getWorld().getName(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
TitleUtil.sendDisplayName(player, event.getPlayer().getName(), ChatColor.stripColor(event.getPlayer().getDisplayName()) + "\n" + TitleUtil.getCustomTitle(event.getPlayer()));
TitleUtil.sendDisplayName(event.getPlayer(), player.getName(), ChatColor.stripColor(player.getDisplayName()) + "\n" + TitleUtil.getCustomTitle(player));
}
}
}, 20L);
EconUtil.sendCurrencyAmount(event.getPlayer(), EconUtil.economy.getBalance(event.getPlayer().getName()));
}
示例6: onPlayerPortal
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerPortal(final PlayerPortalEvent event) {
Bukkit.getScheduler().scheduleSyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
@Override
public void run() {
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
ServerWorldUtil.sendResidenceInfo(event.getPlayer(), res);
// Send Title
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
ServerWorldUtil.sendAdditionalWorldInfo(player, player.getWorld().getName(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
TitleUtil.sendDisplayName(player, event.getPlayer().getName(), ChatColor.stripColor(event.getPlayer().getDisplayName()) + "\n" + TitleUtil.getCustomTitle(event.getPlayer()));
TitleUtil.sendDisplayName(event.getPlayer(), player.getName(), ChatColor.stripColor(player.getDisplayName()) + "\n" + TitleUtil.getCustomTitle(player));
}
}
}, 20L);
EconUtil.sendCurrencyAmount(event.getPlayer(), EconUtil.economy.getBalance(event.getPlayer().getName()));
}
示例7: onPlayerTeleport
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
Bukkit.getScheduler().scheduleSyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
@Override
public void run() {
final ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
ServerWorldUtil.sendResidenceInfo(event.getPlayer(), res);
// Send Title
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
ServerWorldUtil.sendAdditionalWorldInfo(player, player.getWorld().getName(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
TitleUtil.sendDisplayName(player, event.getPlayer().getName(), ChatColor.stripColor(event.getPlayer().getDisplayName()) + "\n" + TitleUtil.getCustomTitle(event.getPlayer()));
TitleUtil.sendDisplayName(event.getPlayer(), player.getName(), ChatColor.stripColor(player.getDisplayName()) + "\n" + TitleUtil.getCustomTitle(player));
}
}
}, 20L);
EconUtil.sendCurrencyAmount(event.getPlayer(), EconUtil.economy.getBalance(event.getPlayer().getName()));
}
示例8: onResidenceFlagChangeEvent
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onResidenceFlagChangeEvent(final ResidenceFlagChangeEvent event) {
Bukkit.getScheduler().scheduleAsyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
public void run() {
if (event.getPlayer() != null) {
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
if (res != null) {
for (Player player : res.getPlayersInResidence()) {
if (player != null) {
ServerWorldUtil.sendResidenceInfo(player, res);
}
}
}
}
}
}, 20L);
}
示例9: onResidenceCommandEvent
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onResidenceCommandEvent(final ResidenceCommandEvent event) {
Bukkit.getScheduler().scheduleAsyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
public void run() {
if (event.getSender() != null) {
Player player = Bukkit.getPlayer(event.getSender().getName());
if (player != null) {
ClaimedResidence res = Residence.getResidenceManager().getByLoc(player.getLocation());
if (res != null) {
ServerWorldUtil.sendResidenceInfo(player, res);
}
}
}
}
}, 10L);
}
示例10: onResidenceCreationEvent
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onResidenceCreationEvent(final ResidenceCreationEvent event) {
Bukkit.getScheduler().scheduleAsyncDelayedTask(BridgePlugin.getInstance(), new Runnable() {
public void run() {
if (event.getPlayer() != null) {
ClaimedResidence res = Residence.getResidenceManager().getByLoc(event.getPlayer().getLocation());
if (res != null) {
for (Player player : res.getPlayersInResidence()) {
if (player != null) {
ServerWorldUtil.sendResidenceInfo(player, res);
}
}
}
}
}
}, 20L);
}
示例11: onEnable
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
public void onEnable()
{
instance=this;
new Messages();
Bukkit.getPluginManager().registerEvents(new Listeners(), instance);
new Metrics(instance);
new ConfigManager();
new BackpackCooldown();
new InteractCooldown();
Plugin sf=Bukkit.getPluginManager().getPlugin("Slimefun");
if(sf==null){
setEnabled(false);
Bukkit.getConsoleSender().sendMessage("§6§lSlimefunBugFixer §7>>> §c§l未找到Slimefun,停止加载");
return;
}
else{
if(sf.getDescription().getVersion().startsWith("4.")){
Bukkit.getPluginManager().registerEvents(new ListenersV4(), instance);
}
}
Plugin res=Bukkit.getPluginManager().getPlugin("Residence");
if(res!=null){
if(res.getDescription().getVersion().startsWith("4")){
RESIDENCE_MAMAGER = Residence.getInstance().getResidenceManager();
Bukkit.getPluginManager().registerEvents(new ListenersRes4(), this);
}
}
if(RESIDENCE_MAMAGER==null){
Bukkit.getConsoleSender().sendMessage("§6§lSlimefunBugFixer §7>>> §c§l未找到ResideceV4.x版本,爆炸镐修复无法启用!");
}
Bukkit.getConsoleSender().sendMessage("§6§lSlimefunBugFixer §7>>> §a§l插件成功加载");
}
示例12: isOwned
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
public Boolean isOwned(Chunk chunk) {
int x1 = chunk.getX() << 4,
z1 = chunk.getZ() << 4,
y1 = 0;
int x2 = x1 + 15,
z2 = z1 + 15,
y2 = chunk.getWorld().getMaxHeight();
Location lowLocation = chunk.getWorld().getBlockAt(x1, y1, z1).getLocation();
Location highLocation = chunk.getWorld().getBlockAt(x2, y2, z2).getLocation();
CuboidArea area = new CuboidArea();
area.setLowLocation(lowLocation);
area.setHighLocation(highLocation);
// TODO: is there a utility method that exists to do this already?
return Residence.getInstance().getResidenceManager().getFromAllResidences(Config.get().residencesIncludeHidden, false, chunk.getWorld()).stream()
.filter(claim ->
claim.checkCollision(area)
/*
claim.getAreaMap().values().stream()
.filter(claimArea -> area.isAreaWithinArea(claimArea))
.findFirst()
.isPresent()
*/
)
.findFirst()
.isPresent();
}
示例13: residenceClaimCheck
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
public boolean residenceClaimCheck(Location loc){
if(wild.getConfig().getBoolean("Residence")) {
ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc);
if (res != null && !checkSurroundingResidences(loc))
return true;
else
return false;
}
else{
return false;
}
}
示例14: checkSurroundingResidences
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
private boolean checkSurroundingResidences(Location loc){
int distance = range / 2;
Vector top = new Vector(loc.getX() + distance, loc.getY(), loc.getZ() + distance);
Vector bottom = new Vector(loc.getX() - distance, loc.getY(), loc.getZ() - distance);
for (int z = bottom.getBlockZ(); z <= top.getBlockZ(); z++) {
for (int x = bottom.getBlockX(); x <= top.getBlockX(); x++) {
loc = new Location(loc.getWorld(), loc.getBlockX()+x, loc.getBlockY(), loc.getBlockZ()+z,loc.getPitch(),loc.getYaw());
ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc);
if(res != null)
return true;
}
}
return false;
}
示例15: checkHook
import com.bekvon.bukkit.residence.Residence; //导入依赖的package包/类
@Override
public boolean checkHook() {
Plugin plugin = Bukkit.getPluginManager().getPlugin("Residence");
if (plugin != null && plugin instanceof Residence) {
Zephyrus.getPlugin().getLogger().info("[Plugin Hooks] Found and hooked Residence");
return true;
}
return false;
}