mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
a2a23d0771
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@
|
|||||||
*.iml
|
*.iml
|
||||||
/target
|
/target
|
||||||
/.DS_Store
|
/.DS_Store
|
||||||
|
/.idea
|
275
locales/vi-VN.yml
Normal file
275
locales/vi-VN.yml
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
###########################################################################################
|
||||||
|
# Đây là 1 file YML, hãy cẩn thận khi chỉnh sửa, nên dùng trang web dể kiểm tra n #
|
||||||
|
# cái này http://yaml-online-parser.appspot.com #
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
|
### Credits ###
|
||||||
|
# tastybento: Người cung cấp bản YML gốc
|
||||||
|
# Poslovitch: Người cung cấp bản YML gốc
|
||||||
|
#
|
||||||
|
# Banbeucmas: Người dịch bản YML gốc
|
||||||
|
# This translation is adapted to version : [alpha-2]
|
||||||
|
|
||||||
|
banner:
|
||||||
|
- "RED"
|
||||||
|
- "CREEPER:YELLOW"
|
||||||
|
- "RHOMBUS_MIDDLE:YELLOW"
|
||||||
|
- "TRIANGLES_BOTTOM:RED"
|
||||||
|
- "SQUARE_BOTTOM_LEFT:RED"
|
||||||
|
- "SQUARE_BOTTOM_RIGHT:RED"
|
||||||
|
|
||||||
|
general:
|
||||||
|
deaths: "Chết"
|
||||||
|
unlimited: "Vô hạn"
|
||||||
|
success: "&aThành công!"
|
||||||
|
errors:
|
||||||
|
command-cancelled: "&cĐã hủy lệnh"
|
||||||
|
no-permission: "&cBạn không có quyền thực thi lệnh này."
|
||||||
|
use-in-game: "&cLệnh này chỉ dùng được trong game."
|
||||||
|
no-team: "&cBạn không ở trong 1 đội nào cả!"
|
||||||
|
no-island: "&cBạn không có đảo!"
|
||||||
|
player-has-no-island: "&cNgười chơi đó không có đảo!"
|
||||||
|
already-have-island: "&cBạn đã có đảo!"
|
||||||
|
no-safe-location: "&cKhông có địa điểm an toàn nào trên đảo!"
|
||||||
|
not-leader: "&cBạn không phải đội trưởng!"
|
||||||
|
not-in-team: "&cNgười chơi không có trong đội!"
|
||||||
|
offline-player: "&cNgười chơi đang offline hoặc không tồn tại."
|
||||||
|
unknown-player: "&cNgười chơi không tìm thấy!"
|
||||||
|
general: "&cLệnh chưa sẵn sàng - hãy liên hệ admin"
|
||||||
|
warp-not-safe: "&cCổng dịch chuyển không an toàn!"
|
||||||
|
wrong-world: "&cBạn đang không ở trong thế giới có thể làm được việc này!"
|
||||||
|
tips:
|
||||||
|
changing-ob-to-lava: "Đang chuyển Hắc Diện Thạch về Dung Nham, hãy cẩn thận"
|
||||||
|
|
||||||
|
commands:
|
||||||
|
help:
|
||||||
|
header: "&7=========== &c%bsb_plugin_name% &7==========="
|
||||||
|
syntax: "&b[usage] &a[parameters]&7: &e[description]"
|
||||||
|
end: "&7================================="
|
||||||
|
parameters: "[command]"
|
||||||
|
description: "help command"
|
||||||
|
admin:
|
||||||
|
help:
|
||||||
|
description: "xem lệnh dành cho admin"
|
||||||
|
parameters: ""
|
||||||
|
version:
|
||||||
|
description: "Hiện phiên bản %bsb_plugin_name% và các bổ sung"
|
||||||
|
setrange:
|
||||||
|
parameters: "[player] [range]"
|
||||||
|
description: "Đặt giới hạn đảo người chơi"
|
||||||
|
range-updated: "Giới hạn đảo đã chuyển sang [number]"
|
||||||
|
reload:
|
||||||
|
description: "Nạp lại plugin"
|
||||||
|
tp:
|
||||||
|
parameters: "[player]"
|
||||||
|
description: "Dịch chuyển đến đảo người chơi"
|
||||||
|
manual: "&cKhông tìm thấy cổng dịch chuyển an toàn! Hãy tp tới địa điểm &b[location] &cvà kiểm tra"
|
||||||
|
island:
|
||||||
|
about:
|
||||||
|
description: "hiện thông tin về %bsb_plugin_name%"
|
||||||
|
go:
|
||||||
|
parameters: "<home number>"
|
||||||
|
description: "dịch chuyển tới đảo"
|
||||||
|
teleport: "&aĐang dịch chuyển. &b/[label] help &ađể được giúp đỡ."
|
||||||
|
teleported: "&aĐã dịch chuyển bạn tới khu vực nhà số &e#[number]."
|
||||||
|
help:
|
||||||
|
description: "Các lệnh chính"
|
||||||
|
spawn:
|
||||||
|
description: "dịch chuyển ra spawn"
|
||||||
|
create:
|
||||||
|
description: "tạo đảo"
|
||||||
|
unable-create-island: "Không thể khởi tạo đảo, hãy liên hệ admin."
|
||||||
|
creating-island: "Đang tạo đảo..."
|
||||||
|
info:
|
||||||
|
description: "hiện thông tin đảo của bạn"
|
||||||
|
reset:
|
||||||
|
description: "làm lại đảo của bạn"
|
||||||
|
must-remove-members: "Hãy đuổi toàn bộ thành viên trước khi khởi tạo lại đảo (/island kick <người chơi>)."
|
||||||
|
sethome:
|
||||||
|
description: "đặt bị trí dịch chuyển cho /island"
|
||||||
|
must-be-on-your-island: "Bạn phải ở trên đảo của bạn!"
|
||||||
|
num-homes: "Số nhà có thể đặt từ 1 đến [max]."
|
||||||
|
home-set: "Đã đặt vị trí nhà tại địa điểm hiện tại của bạn."
|
||||||
|
parameters: "<home number>"
|
||||||
|
setname:
|
||||||
|
description: "đặt tên đảo"
|
||||||
|
name-too-short: "&cQuá ngắn. Giới hạn thấp nhất là [length] kí tự."
|
||||||
|
name-too-long: "&cQuá dài. Giới hạn tối đa là [length] kí tự."
|
||||||
|
parameters: "<name>"
|
||||||
|
resetname:
|
||||||
|
description: "làm lại tên đảo"
|
||||||
|
team:
|
||||||
|
description: "quản lý đội"
|
||||||
|
info:
|
||||||
|
description: "hiện thông tin chi tiết về đội"
|
||||||
|
invite:
|
||||||
|
description: "mới người chơi đến đảo"
|
||||||
|
invitation-sent: "Đã gửi lời mời tới [name]"
|
||||||
|
removing-invite: "Đang bỏ lời bời"
|
||||||
|
name-has-invited-you: "[name] đã mời bạn vào đảo."
|
||||||
|
to-accept-or-reject: "Ghi /island team accept để chấp nhận, hay /island team reject để từ chối"
|
||||||
|
you-will-lose-your-island: "&cCẢNH BÁO! Bạn sẽ mất đảo nếu chấp nhận"
|
||||||
|
errors:
|
||||||
|
cannot-invite-self: "&cBạn không thể mới chính mình"
|
||||||
|
cooldown: "&cBạn không thế mời người khác trong [time] giây"
|
||||||
|
island-is-full: "&cĐảo đã đầy, không thể mời thêm"
|
||||||
|
none-invited-you: "&cKhông ai mời bạn :c."
|
||||||
|
you-already-are-in-team: "&cBạn đã ở trong 1 đội!"
|
||||||
|
already-on-team: "&cNgười chơi đó đã ở trong 1 đội!"
|
||||||
|
invalid-invite: "&cLời mời vô hiệu, xin lỗi."
|
||||||
|
parameters: "<player>"
|
||||||
|
you-can-invite: "Bạn có thể mời thêm [number] người."
|
||||||
|
accept:
|
||||||
|
description: "chấp nhận lời mời"
|
||||||
|
you-joined-island: "&aBạn đã tham gia đảo! Sử dụng /[label] team info để biết thêm thông tin."
|
||||||
|
name-joined-your-island: "&a[name] đã vào đảo của bạn!"
|
||||||
|
reject:
|
||||||
|
description: "từ chối lời mời"
|
||||||
|
you-rejected-invite: "&aBạn đã từ chối lời mời vào đảo."
|
||||||
|
name-rejected-your-invite: "&c[name] đã từ chối lời mời của bạn!"
|
||||||
|
cancel:
|
||||||
|
description: "hủy lời mời hiện tại"
|
||||||
|
leave:
|
||||||
|
description: "rời đảo"
|
||||||
|
type-again: "&cGõ lệnh rời đảo 1 lần nữa để xác nhận"
|
||||||
|
left-your-island: "&c[player] đã rời đảo"
|
||||||
|
kick:
|
||||||
|
description: "loại bỏ 1 người chơi khỏi đảo"
|
||||||
|
parameters: "<player>"
|
||||||
|
type-again: "&cHãy đánh lệnh loại bỏ 1 lần nữa để xác nhận"
|
||||||
|
leader-kicked: "&cĐội trưởng đã đuổi bạn ra khỏi đội!"
|
||||||
|
demote:
|
||||||
|
description: "hạ cấp bậc người chơi"
|
||||||
|
parameters: "<player>"
|
||||||
|
failure: "&cNgười chơi không thể hạ cấp thêm nữa"
|
||||||
|
success: "Đã hạ cấp [name] đến bậc [rank]"
|
||||||
|
promote:
|
||||||
|
description: "thăng chức người chơi"
|
||||||
|
parameters: "<player>"
|
||||||
|
failure: "&cKhông thể thăng chức nữa!"
|
||||||
|
success: "Đã thăng chức [name] lên bậc [rank]"
|
||||||
|
setowner:
|
||||||
|
description: "chuyển quyền sở hữu đảo"
|
||||||
|
errors:
|
||||||
|
cant-transfer-to-yourself: "&cBạn không thể chuyển quyền sở hữu cho chính mình"
|
||||||
|
target-is-not-member: "&cNgười chơi đó không phải là người trong đội!"
|
||||||
|
name-is-the-owner: "&a[name] giờ là chủ đảo!"
|
||||||
|
parameters: "<player>"
|
||||||
|
you-are-the-owner: "&aBạn giờ là chủ đảo!"
|
||||||
|
ban:
|
||||||
|
description: "cấm 1 người chơi khỏi đảo"
|
||||||
|
parameters: "<player>"
|
||||||
|
unban:
|
||||||
|
description: "bỏ cấm 1 người chơi khỏi đảo"
|
||||||
|
parameters: "<player>"
|
||||||
|
banlist:
|
||||||
|
description: "những người chơi bị cấm"
|
||||||
|
lock:
|
||||||
|
description: "khóa/bỏ khóa khả năng truy cập đảo của bạn"
|
||||||
|
settings:
|
||||||
|
description: "hiện cài đặt đảo"
|
||||||
|
language:
|
||||||
|
description: "chọn ngôn ngữ"
|
||||||
|
parameters: "<language>"
|
||||||
|
|
||||||
|
ranks:
|
||||||
|
owner: "Chủ"
|
||||||
|
member: "Thành Viên"
|
||||||
|
coop: "Đối tác"
|
||||||
|
visitor: "Khách"
|
||||||
|
banned: "Bị cấm"
|
||||||
|
|
||||||
|
protection:
|
||||||
|
protected: "&cĐã bảo vệ đảo!"
|
||||||
|
flags:
|
||||||
|
ANVIL:
|
||||||
|
name: "Đe"
|
||||||
|
description: "Tắt/bật tương tác với Đe"
|
||||||
|
ARMOR_STAND:
|
||||||
|
name: "Giá để giáp"
|
||||||
|
description: "Tắt/bật tương tác với giá để giáp"
|
||||||
|
BEACON:
|
||||||
|
name: "Beacons"
|
||||||
|
description: "Tắt/bật tương tác với beacons"
|
||||||
|
BED:
|
||||||
|
name: "Giường"
|
||||||
|
description: "Tắt/bật tương tác với giường"
|
||||||
|
BREAK_BLOCKS:
|
||||||
|
name: "Phá khối"
|
||||||
|
description: "Tắt/bật khả năng phá khối"
|
||||||
|
BREEDING:
|
||||||
|
name: "Giao phối"
|
||||||
|
description: "Tắt/bật khả năng giao phối của dộng vật"
|
||||||
|
BREWING:
|
||||||
|
name: "Brewing stands"
|
||||||
|
description: "Tắt/bật tương tác với brewing stands"
|
||||||
|
BUCKET:
|
||||||
|
name: "Xô"
|
||||||
|
description: "Tắt/bật tương tác với xô"
|
||||||
|
COLLECT_WATER:
|
||||||
|
name: "Lấy nước"
|
||||||
|
description: |
|
||||||
|
Tắt/bật khả năng lấy nước bằng xô
|
||||||
|
COLLECT_LAVA:
|
||||||
|
name: "Lấy dung nham"
|
||||||
|
description: |
|
||||||
|
Tắt/bật khả năng lấy nước bằng xô
|
||||||
|
CHORUS_FRUIT:
|
||||||
|
name: "Chorus fruits"
|
||||||
|
description: "Toggle teleportation using Chorus fruits"
|
||||||
|
CRAFTING: "Use crafting table"
|
||||||
|
CROP_TRAMPLE: "Trample crops"
|
||||||
|
DOOR: "Use doors"
|
||||||
|
ELYTRA: "Use elytras"
|
||||||
|
ENCHANTING: "Use enchanting table"
|
||||||
|
ENTER_EXIT_MESSAGES: "Display entry and exit messages"
|
||||||
|
FIRE: "FIRE"
|
||||||
|
FIRE_EXTINGUISH: "FIRE_EXTINGUISH"
|
||||||
|
FIRE_SPREAD: "FIRE_SPREAD"
|
||||||
|
FURNACE: "FURNACE"
|
||||||
|
GATE: "GATE"
|
||||||
|
HURT_ANIMALS: "HURT_ANIMALS"
|
||||||
|
HURT_MONSTERS: "HURT_MONSTERS"
|
||||||
|
HURT_VILLAGERS: "HURT_VILLAGERS"
|
||||||
|
ITEM_DROP: "ITEM_DROP"
|
||||||
|
ITEM_PICKUP: "ITEM_PICKUP"
|
||||||
|
LEASH: "LEASH"
|
||||||
|
MILKING: "MILKING"
|
||||||
|
MOB_SPAWN: "MOB_SPAWN"
|
||||||
|
MONSTER_SPAWN: "MONSTER_SPAWN"
|
||||||
|
MOUNT_INVENTORY: "MOUNT_INVENTORY"
|
||||||
|
RIDING: "RIDING"
|
||||||
|
MUSIC: "MUSIC"
|
||||||
|
CHEST: "CHEST"
|
||||||
|
PLACE_BLOCKS: "PLACE_BLOCKS"
|
||||||
|
PORTAL: "PORTAL"
|
||||||
|
PRESSURE_PLATE: "PRESSURE_PLATE"
|
||||||
|
PVP_OVERWORLD: "PVP_OVERWORLD"
|
||||||
|
PVP_NETHER: "PVP_NETHER"
|
||||||
|
PVP_END: "PVP_END"
|
||||||
|
REDSTONE: "REDSTONE"
|
||||||
|
SPAWN_EGGS: "SPAWN_EGGS"
|
||||||
|
SHEARING: "SHEARING"
|
||||||
|
EGGS: "EGGS"
|
||||||
|
TRADING: "TRADING"
|
||||||
|
panel:
|
||||||
|
title: "Island flags"
|
||||||
|
flag-item:
|
||||||
|
name-layout: "&a[name]"
|
||||||
|
description-layout: |+
|
||||||
|
&a[description]
|
||||||
|
|
||||||
|
&7Allowed for: &f[rank]
|
||||||
|
help-item:
|
||||||
|
name: "&aNeed some help?"
|
||||||
|
|
||||||
|
|
||||||
|
island:
|
||||||
|
locked: "&cThis island is locked!"
|
||||||
|
|
||||||
|
new-island:
|
||||||
|
sign:
|
||||||
|
line0: "&1%bsb_plugin_name%"
|
||||||
|
line1: "[player]"
|
||||||
|
line2: "Đừng rơi"
|
||||||
|
line3: "Vui vẻ &c<3"
|
@ -63,7 +63,6 @@ public class BSkyBlock extends JavaPlugin {
|
|||||||
settings = new Settings();
|
settings = new Settings();
|
||||||
// Load settings from config.yml. This will check if there are any issues with it too.
|
// Load settings from config.yml. This will check if there are any issues with it too.
|
||||||
try {
|
try {
|
||||||
//settings.saveSettings();
|
|
||||||
settings = settings.loadSettings();
|
settings = settings.loadSettings();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
getLogger().severe("Settings could not be loaded " + e.getMessage());
|
getLogger().severe("Settings could not be loaded " + e.getMessage());
|
||||||
@ -282,8 +281,6 @@ public class BSkyBlock extends JavaPlugin {
|
|||||||
return notifier;
|
return notifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the headGetter
|
* @return the headGetter
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package us.tastybento.bskyblock;
|
package us.tastybento.bskyblock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the plugin constants are here
|
* Contains the plugin constants.
|
||||||
* @author Tastybento
|
* @author tastybento
|
||||||
*/
|
*/
|
||||||
public class Constants {
|
public class Constants {
|
||||||
// ----------------- Constants -----------------
|
// ----------------- Constants -----------------
|
||||||
@ -10,17 +10,7 @@ public class Constants {
|
|||||||
public enum GameType {
|
public enum GameType {
|
||||||
BSKYBLOCK, ACIDISLAND, BOTH
|
BSKYBLOCK, ACIDISLAND, BOTH
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public static final GameType GAMETYPE = GameType.ACIDISLAND;
|
|
||||||
// The spawn command (Essentials spawn for example)
|
|
||||||
public static final String SPAWNCOMMAND = "spawn";
|
|
||||||
// Permission prefix
|
|
||||||
public static final String PERMPREFIX = "acidisland.";
|
|
||||||
// The island command
|
|
||||||
public static final String ISLANDCOMMAND = "ai";
|
|
||||||
// Admin command
|
|
||||||
public static final String ADMINCOMMAND = "acid";
|
|
||||||
*/
|
|
||||||
public static final GameType GAMETYPE = GameType.BSKYBLOCK;
|
public static final GameType GAMETYPE = GameType.BSKYBLOCK;
|
||||||
// Permission prefix
|
// Permission prefix
|
||||||
public static final String PERMPREFIX = "bskyblock.";
|
public static final String PERMPREFIX = "bskyblock.";
|
||||||
|
@ -404,7 +404,7 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
if (cmd.hasSubCommmands()) {
|
if (cmd.hasSubCommmands()) {
|
||||||
// Check if subcommands are visible to this sender
|
// Check if subcommands are visible to this sender
|
||||||
for (CompositeCommand subCommand: cmd.getSubCommands().values()) {
|
for (CompositeCommand subCommand: cmd.getSubCommands().values()) {
|
||||||
if ((sender instanceof Player)) {
|
if (sender instanceof Player) {
|
||||||
// Player
|
// Player
|
||||||
if (subCommand.getPermission().isEmpty() || sender.hasPermission(subCommand.getPermission())) {
|
if (subCommand.getPermission().isEmpty() || sender.hasPermission(subCommand.getPermission())) {
|
||||||
// Permission is okay
|
// Permission is okay
|
||||||
@ -419,7 +419,8 @@ public abstract class CompositeCommand extends Command implements PluginIdentifi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String lastArg = (args.length != 0 ? args[args.length - 1] : "");
|
|
||||||
|
String lastArg = args.length != 0 ? args[args.length - 1] : "";
|
||||||
|
|
||||||
return Util.tabLimit(options, lastArg);
|
return Util.tabLimit(options, lastArg);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ public abstract class PremadeEvent extends Event {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return getHandlerList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
|
@ -14,7 +14,7 @@ public class EntityDamageByAcidEvent extends IslandBaseEvent {
|
|||||||
private final Entity entity;
|
private final Entity entity;
|
||||||
private double damage;
|
private double damage;
|
||||||
|
|
||||||
public enum Acid { RAIN, WATER };
|
public enum Acid { RAIN, WATER }
|
||||||
private final Acid cause;
|
private final Acid cause;
|
||||||
|
|
||||||
public EntityDamageByAcidEvent(Island island, Entity entity, double damage, Acid cause) {
|
public EntityDamageByAcidEvent(Island island, Entity entity, double damage, Acid cause) {
|
||||||
|
@ -28,7 +28,7 @@ public class IslandEvent {
|
|||||||
RESETTED,
|
RESETTED,
|
||||||
UNLOCK,
|
UNLOCK,
|
||||||
UNKNOWN
|
UNKNOWN
|
||||||
};
|
}
|
||||||
|
|
||||||
public static IslandEventBuilder builder() {
|
public static IslandEventBuilder builder() {
|
||||||
return new IslandEventBuilder();
|
return new IslandEventBuilder();
|
||||||
|
@ -26,7 +26,7 @@ public class TeamEvent {
|
|||||||
DELETE,
|
DELETE,
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
UNINVITE
|
UNINVITE
|
||||||
};
|
}
|
||||||
|
|
||||||
public static TeamEventBuilder builder() {
|
public static TeamEventBuilder builder() {
|
||||||
return new TeamEventBuilder();
|
return new TeamEventBuilder();
|
||||||
|
@ -99,10 +99,8 @@ public class Flag implements Comparable<Flag> {
|
|||||||
} else if (!id.equals(other.id)) {
|
} else if (!id.equals(other.id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (type != other.type) {
|
|
||||||
return false;
|
return type == other.type;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PanelItem toPanelItem(User user) {
|
public PanelItem toPanelItem(User user) {
|
||||||
|
@ -28,7 +28,6 @@ public class PanelItem {
|
|||||||
public PanelItem(ItemStack icon, String name, List<String> description, boolean glow, ClickHandler clickHandler, boolean playerHead) {
|
public PanelItem(ItemStack icon, String name, List<String> description, boolean glow, ClickHandler clickHandler, boolean playerHead) {
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
this.playerHead = playerHead;
|
this.playerHead = playerHead;
|
||||||
setMeta();
|
|
||||||
// Get the meta
|
// Get the meta
|
||||||
meta = icon.getItemMeta();
|
meta = icon.getItemMeta();
|
||||||
|
|
||||||
@ -48,11 +47,6 @@ public class PanelItem {
|
|||||||
icon.setItemMeta(meta);
|
icon.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMeta() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getItem() {
|
public ItemStack getItem() {
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
@ -117,7 +111,6 @@ public class PanelItem {
|
|||||||
|
|
||||||
public void setHead(ItemStack itemStack) {
|
public void setHead(ItemStack itemStack) {
|
||||||
this.icon = itemStack;
|
this.icon = itemStack;
|
||||||
setMeta();
|
|
||||||
// Get the meta
|
// Get the meta
|
||||||
meta = icon.getItemMeta();
|
meta = icon.getItemMeta();
|
||||||
// Create the final item
|
// Create the final item
|
||||||
|
@ -16,7 +16,7 @@ public class Notifier {
|
|||||||
/**
|
/**
|
||||||
* Time in seconds before {@link #notificationCache} removes the entry related to the player.
|
* Time in seconds before {@link #notificationCache} removes the entry related to the player.
|
||||||
*/
|
*/
|
||||||
private final int NOTIFICATION_DELAY = 5;
|
private static final int NOTIFICATION_DELAY = 5;
|
||||||
|
|
||||||
private final LoadingCache<User, Notification> notificationCache = CacheBuilder.newBuilder()
|
private final LoadingCache<User, Notification> notificationCache = CacheBuilder.newBuilder()
|
||||||
.expireAfterAccess(NOTIFICATION_DELAY, TimeUnit.SECONDS)
|
.expireAfterAccess(NOTIFICATION_DELAY, TimeUnit.SECONDS)
|
||||||
|
@ -50,7 +50,7 @@ public abstract class AbstractDatabaseHandler<T> {
|
|||||||
* Loads all the records in this table and returns a list of them
|
* Loads all the records in this table and returns a list of them
|
||||||
* @return list of <T>
|
* @return list of <T>
|
||||||
*/
|
*/
|
||||||
public abstract List<T> loadObjects() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, IntrospectionException;
|
public abstract List<T> loadObjects() throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a <T> filled with values from the corresponding
|
* Creates a <T> filled with values from the corresponding
|
||||||
@ -58,20 +58,20 @@ public abstract class AbstractDatabaseHandler<T> {
|
|||||||
* @param uniqueId - unique ID
|
* @param uniqueId - unique ID
|
||||||
* @return <T>
|
* @return <T>
|
||||||
*/
|
*/
|
||||||
public abstract T loadObject(String uniqueId) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, IntrospectionException;
|
public abstract T loadObject(String uniqueId) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save T into the corresponding database
|
* Save T into the corresponding database
|
||||||
*
|
*
|
||||||
* @param instance that should be inserted into the database
|
* @param instance that should be inserted into the database
|
||||||
*/
|
*/
|
||||||
public abstract void saveObject(T instance) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException ;
|
public abstract void saveObject(T instance) throws IllegalAccessException, InvocationTargetException, IntrospectionException ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the object with the unique id from the database
|
* Deletes the object with the unique id from the database
|
||||||
* @param instance
|
* @param instance
|
||||||
*/
|
*/
|
||||||
public abstract void deleteObject(T instance) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException ;
|
public abstract void deleteObject(T instance) throws IllegalAccessException, InvocationTargetException, IntrospectionException ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a key exists or not
|
* Checks if a key exists or not
|
||||||
|
@ -21,12 +21,12 @@ public class ConfigHandler<T> extends FlatFileDatabaseHandler<T> {
|
|||||||
super(plugin, type, databaseConnecter);
|
super(plugin, type, databaseConnecter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveSettings(T instance) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, IntrospectionException {
|
public void saveSettings(T instance) throws IllegalAccessException, InvocationTargetException, IntrospectionException {
|
||||||
configFlag = true;
|
configFlag = true;
|
||||||
saveObject(instance);
|
saveObject(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T loadSettings(String uniqueId, T dbConfig) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, IntrospectionException {
|
public T loadSettings(String uniqueId, T dbConfig) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException {
|
||||||
if (dbConfig == null) {
|
if (dbConfig == null) {
|
||||||
return loadObject(uniqueId);
|
return loadObject(uniqueId);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ public class FlatFileDatabase extends BSBDbSetup{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractDatabaseHandler<?> getHandler(Class<?> type) {
|
public AbstractDatabaseHandler<?> getHandler(Class<?> type) {
|
||||||
return new FlatFileDatabaseHandler<>(BSkyBlock.getInstance(), type, new FlatFileDatabaseConnecter(BSkyBlock.getInstance(), null));
|
return new FlatFileDatabaseHandler<>(BSkyBlock.getInstance(), type, new FlatFileDatabaseConnecter(BSkyBlock.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,7 +17,7 @@ public class FlatFileDatabase extends BSBDbSetup{
|
|||||||
* @return - the config handler
|
* @return - the config handler
|
||||||
*/
|
*/
|
||||||
public AbstractDatabaseHandler<?> getConfig(Class<?> type) {
|
public AbstractDatabaseHandler<?> getConfig(Class<?> type) {
|
||||||
return new ConfigHandler<>(BSkyBlock.getInstance(), type, new FlatFileDatabaseConnecter(BSkyBlock.getInstance(), null));
|
return new ConfigHandler<>(BSkyBlock.getInstance(), type, new FlatFileDatabaseConnecter(BSkyBlock.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ public class FlatFileDatabaseConnecter implements DatabaseConnecter {
|
|||||||
private File dataFolder;
|
private File dataFolder;
|
||||||
|
|
||||||
|
|
||||||
public FlatFileDatabaseConnecter(Plugin plugin, DatabaseConnectionSettingsImpl databaseConnectionSettingsImpl) {
|
public FlatFileDatabaseConnecter(Plugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
dataFolder = new File(plugin.getDataFolder(), DATABASE_FOLDER_NAME);
|
dataFolder = new File(plugin.getDataFolder(), DATABASE_FOLDER_NAME);
|
||||||
}
|
}
|
||||||
|
@ -194,13 +194,6 @@ public class Island implements DataObject {
|
|||||||
return levelHandicap;
|
return levelHandicap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if the island is locked, otherwise false
|
|
||||||
*/
|
|
||||||
public boolean getLocked(){
|
|
||||||
return locked;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the members
|
* @return the members
|
||||||
*/
|
*/
|
||||||
@ -294,13 +287,6 @@ public class Island implements DataObject {
|
|||||||
return members.getOrDefault(user.getUniqueId(), RanksManager.VISITOR_RANK);
|
return members.getOrDefault(user.getUniqueId(), RanksManager.VISITOR_RANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if the island is the spawn otherwise false
|
|
||||||
*/
|
|
||||||
public boolean getSpawn(){
|
|
||||||
return spawn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getSpawnPoint() {
|
public Location getSpawnPoint() {
|
||||||
return spawnPoint;
|
return spawnPoint;
|
||||||
}
|
}
|
||||||
@ -326,10 +312,8 @@ public class Island implements DataObject {
|
|||||||
if (holder.getType().equals(Material.BURNING_FURNACE)) {
|
if (holder.getType().equals(Material.BURNING_FURNACE)) {
|
||||||
result++;
|
result++;
|
||||||
}
|
}
|
||||||
} else if (material.toString().endsWith("BANNER")) {
|
} else if (material.toString().endsWith("BANNER") && holder.getType().toString().endsWith("BANNER")) {
|
||||||
if (holder.getType().toString().endsWith("BANNER")) {
|
result++;
|
||||||
result++;
|
|
||||||
}
|
|
||||||
} else if (material.equals(Material.WALL_SIGN) || material.equals(Material.SIGN_POST)) {
|
} else if (material.equals(Material.WALL_SIGN) || material.equals(Material.SIGN_POST)) {
|
||||||
if (holder.getType().equals(Material.WALL_SIGN) || holder.getType().equals(Material.SIGN_POST)) {
|
if (holder.getType().equals(Material.WALL_SIGN) || holder.getType().equals(Material.SIGN_POST)) {
|
||||||
result++;
|
result++;
|
||||||
@ -519,9 +503,7 @@ public class Island implements DataObject {
|
|||||||
* Resets the flags to their default as set in config.yml for this island
|
* Resets the flags to their default as set in config.yml for this island
|
||||||
*/
|
*/
|
||||||
public void setFlagsDefaults(){
|
public void setFlagsDefaults(){
|
||||||
/*for(SettingsFlag flag : SettingsFlag.values()){
|
//TODO default flags
|
||||||
this.flags.put(flag, Settings.defaultIslandSettings.get(flag));
|
|
||||||
}*/ //TODO default flags
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -650,9 +632,7 @@ public class Island implements DataObject {
|
|||||||
* Resets the flags to their default as set in config.yml for the spawn
|
* Resets the flags to their default as set in config.yml for the spawn
|
||||||
*/
|
*/
|
||||||
public void setSpawnFlagsDefaults(){
|
public void setSpawnFlagsDefaults(){
|
||||||
/*for(SettingsFlag flag : SettingsFlag.values()){
|
//TODO default flags
|
||||||
this.flags.put(flag, Settings.defaultSpawnSettings.get(flag));
|
|
||||||
}*/ //TODO default flags
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpawnPoint(Location location) {
|
public void setSpawnPoint(Location location) {
|
||||||
|
@ -232,7 +232,6 @@ public class Players implements DataObject {
|
|||||||
Date kickedDate = new Date(kickedList.get(location));
|
Date kickedDate = new Date(kickedList.get(location));
|
||||||
Calendar coolDownTime = Calendar.getInstance();
|
Calendar coolDownTime = Calendar.getInstance();
|
||||||
coolDownTime.setTime(kickedDate);
|
coolDownTime.setTime(kickedDate);
|
||||||
// coolDownTime.add(Calendar.HOUR_OF_DAY, Settings.inviteWait);
|
|
||||||
coolDownTime.add(Calendar.MINUTE, getPlugin().getSettings().getInviteWait());
|
coolDownTime.add(Calendar.MINUTE, getPlugin().getSettings().getInviteWait());
|
||||||
// Add the invite cooldown period
|
// Add the invite cooldown period
|
||||||
Calendar timeNow = Calendar.getInstance();
|
Calendar timeNow = Calendar.getInstance();
|
||||||
|
@ -40,13 +40,13 @@ public class IslandBuilder {
|
|||||||
private Island island;
|
private Island island;
|
||||||
private World world;
|
private World world;
|
||||||
private IslandType type = IslandType.ISLAND;
|
private IslandType type = IslandType.ISLAND;
|
||||||
//private List<String> companionNames = new ArrayList<>();
|
|
||||||
private List<ItemStack> chestItems;
|
private List<ItemStack> chestItems;
|
||||||
//private List<Entity> companions = new ArrayList<>();
|
|
||||||
private UUID playerUUID;
|
private UUID playerUUID;
|
||||||
private String playerName;
|
private String playerName;
|
||||||
private BSkyBlock plugin;
|
private BSkyBlock plugin;
|
||||||
|
|
||||||
|
//TODO support companions?
|
||||||
|
|
||||||
public IslandBuilder(BSkyBlock plugin, Island island) {
|
public IslandBuilder(BSkyBlock plugin, Island island) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.island = island;
|
this.island = island;
|
||||||
@ -208,8 +208,6 @@ public class IslandBuilder {
|
|||||||
// Add tree (natural)
|
// Add tree (natural)
|
||||||
Location treeLoc = new Location(world, x, y + 5D, z);
|
Location treeLoc = new Location(world, x, y + 5D, z);
|
||||||
world.generateTree(treeLoc, TreeType.ACACIA);
|
world.generateTree(treeLoc, TreeType.ACACIA);
|
||||||
// Place the cow
|
|
||||||
//Location location = new Location(world, x, (islandHeight + 5), z - 2);
|
|
||||||
|
|
||||||
// Place a helpful sign in front of player
|
// Place a helpful sign in front of player
|
||||||
placeSign(x, islandHeight + 5, z + 3);
|
placeSign(x, islandHeight + 5, z + 3);
|
||||||
@ -295,8 +293,6 @@ public class IslandBuilder {
|
|||||||
// Add tree (natural)
|
// Add tree (natural)
|
||||||
Location treeLoc = new Location(world, x, y + 5D, z);
|
Location treeLoc = new Location(world, x, y + 5D, z);
|
||||||
world.generateTree(treeLoc, TreeType.TREE);
|
world.generateTree(treeLoc, TreeType.TREE);
|
||||||
// Place the cow
|
|
||||||
//Location location = new Location(world, x, (islandHeight + 5), z - 2);
|
|
||||||
|
|
||||||
// Place a helpful sign in front of player
|
// Place a helpful sign in front of player
|
||||||
placeSign(x, islandHeight + 5, z + 3);
|
placeSign(x, islandHeight + 5, z + 3);
|
||||||
@ -373,18 +369,11 @@ public class IslandBuilder {
|
|||||||
|
|
||||||
// Add island items
|
// Add island items
|
||||||
y = islandHeight;
|
y = islandHeight;
|
||||||
// Add tree (natural)
|
|
||||||
Location treeLoc = new Location(world, x, y + 5D, z);
|
|
||||||
treeLoc.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
|
|
||||||
world.generateTree(treeLoc, TreeType.TREE);
|
|
||||||
// Place the cow
|
|
||||||
//Location location = new Location(world, x, (islandHeight + 5), z - 2);
|
|
||||||
|
|
||||||
// Place a helpful sign in front of player
|
// Place a helpful sign in front of player
|
||||||
placeSign(x, islandHeight + 5, z + 3);
|
placeSign(x, islandHeight + 5, z + 3);
|
||||||
// Place the chest - no need to use the safe spawn function
|
// Place the chest - no need to use the safe spawn function
|
||||||
// because we
|
// because we know what this island looks like
|
||||||
// know what this island looks like
|
|
||||||
placeChest(x, islandHeight + 5, z + 1);
|
placeChest(x, islandHeight + 5, z + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,12 +445,8 @@ public class IslandBuilder {
|
|||||||
|
|
||||||
// Add island items
|
// Add island items
|
||||||
y = islandHeight;
|
y = islandHeight;
|
||||||
// Add tree (natural)
|
// Spawn an ender crystal
|
||||||
Location treeLoc = new Location(world, x, y + 5D, z);
|
world.spawnEntity(new Location(world, x, y + 5D, z), EntityType.ENDER_CRYSTAL);
|
||||||
world.spawnEntity(treeLoc, EntityType.ENDER_CRYSTAL);
|
|
||||||
//world.generateTree(treeLoc, TreeType.TREE);
|
|
||||||
// Place the cow
|
|
||||||
//Location location = new Location(world, x, (islandHeight + 5), z - 2);
|
|
||||||
|
|
||||||
// Place a helpful sign in front of player
|
// Place a helpful sign in front of player
|
||||||
placeSign(x, islandHeight + 5, z + 3);
|
placeSign(x, islandHeight + 5, z + 3);
|
||||||
|
@ -16,6 +16,9 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import us.tastybento.bskyblock.BSkyBlock;
|
import us.tastybento.bskyblock.BSkyBlock;
|
||||||
import us.tastybento.bskyblock.api.user.User;
|
import us.tastybento.bskyblock.api.user.User;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables changing of obsidian back into lava
|
* Enables changing of obsidian back into lava
|
||||||
* @author tastybento
|
* @author tastybento
|
||||||
@ -25,7 +28,6 @@ public class ObsidianToLava implements Listener {
|
|||||||
|
|
||||||
private BSkyBlock plugin;
|
private BSkyBlock plugin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param plugin
|
* @param plugin
|
||||||
*/
|
*/
|
||||||
@ -33,7 +35,6 @@ public class ObsidianToLava implements Listener {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables changing of obsidian back into lava
|
* Enables changing of obsidian back into lava
|
||||||
*
|
*
|
||||||
@ -54,18 +55,14 @@ public class ObsidianToLava implements Listener {
|
|||||||
if (plugin.getIslands().playerIsOnIsland(user)) {
|
if (plugin.getIslands().playerIsOnIsland(user)) {
|
||||||
// Look around to see if this is a lone obsidian block
|
// Look around to see if this is a lone obsidian block
|
||||||
Block b = e.getClickedBlock();
|
Block b = e.getClickedBlock();
|
||||||
for (int x = -2; x <= 2; x++) {
|
|
||||||
for (int y = -2; y <= 2; y++) {
|
|
||||||
for (int z = -2; z <= 2; z++) {
|
|
||||||
Material testBlock = b.getWorld().getBlockAt(b.getX() + x, b.getY() + y, b.getZ() + z).getType();
|
|
||||||
if ((x != 0 || y != 0 || z != 0) && testBlock.equals(Material.OBSIDIAN)) {
|
|
||||||
// Do nothing special
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
for (Block testBlock : getBlocksAround(b)) {
|
||||||
}
|
if (testBlock.getType().equals(Material.OBSIDIAN)) {
|
||||||
|
// Do nothing special
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user.sendMessage("general.tips.changing-ob-to-lava");
|
user.sendMessage("general.tips.changing-ob-to-lava");
|
||||||
e.getItem().setType(Material.LAVA_BUCKET);
|
e.getItem().setType(Material.LAVA_BUCKET);
|
||||||
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ITEM_BUCKET_FILL_LAVA, 1F, 1F);
|
e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ITEM_BUCKET_FILL_LAVA, 1F, 1F);
|
||||||
@ -76,4 +73,20 @@ public class ObsidianToLava implements Listener {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Block> getBlocksAround(Block b) {
|
||||||
|
List<Block> blocksAround = new ArrayList<>();
|
||||||
|
for (int x = -2; x <= 2; x++) {
|
||||||
|
for (int y = -2; y <= 2; y++) {
|
||||||
|
for (int z = -2; z <= 2; z++) {
|
||||||
|
blocksAround.add(b.getWorld().getBlockAt(b.getX() + x, b.getY() + y, b.getZ() + z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the block at x = 0, y = 0 and z = 0 (which is the base block)
|
||||||
|
blocksAround.remove(b);
|
||||||
|
|
||||||
|
return blocksAround;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
|
|
||||||
import us.tastybento.bskyblock.api.flags.Flag;
|
import us.tastybento.bskyblock.api.flags.Flag;
|
||||||
import us.tastybento.bskyblock.api.user.User;
|
import us.tastybento.bskyblock.api.user.User;
|
||||||
|
import us.tastybento.bskyblock.lists.Flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: PVP is different to other flags - it's either allowed for everyone or not allowed for everyone. Currently owners can hit visitors.
|
* TODO: PVP is different to other flags - it's either allowed for everyone or not allowed for everyone. Currently owners can hit visitors.
|
||||||
@ -42,11 +43,11 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onEntityDamage(final EntityDamageByEntityEvent e) {
|
public void onEntityDamage(final EntityDamageByEntityEvent e) {
|
||||||
if (e.getEntity() instanceof Player) {
|
if (e.getEntity() instanceof Player) {
|
||||||
Flag flag = us.tastybento.bskyblock.lists.Flags.PVP_OVERWORLD;
|
Flag flag = Flags.PVP_OVERWORLD;
|
||||||
if (e.getEntity().getWorld().equals(getPlugin().getIslandWorldManager().getNetherWorld())) {
|
if (e.getEntity().getWorld().equals(getPlugin().getIslandWorldManager().getNetherWorld())) {
|
||||||
flag = us.tastybento.bskyblock.lists.Flags.PVP_NETHER;
|
flag = Flags.PVP_NETHER;
|
||||||
} else if (e.getEntity().getWorld().equals(getPlugin().getIslandWorldManager().getEndWorld())) {
|
} else if (e.getEntity().getWorld().equals(getPlugin().getIslandWorldManager().getEndWorld())) {
|
||||||
flag = us.tastybento.bskyblock.lists.Flags.PVP_END;
|
flag = Flags.PVP_END;
|
||||||
}
|
}
|
||||||
respond(e, e.getDamager(), flag);
|
respond(e, e.getDamager(), flag);
|
||||||
}
|
}
|
||||||
@ -72,11 +73,11 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onFishing(PlayerFishEvent e) {
|
public void onFishing(PlayerFishEvent e) {
|
||||||
if (e.getCaught() != null && e.getCaught() instanceof Player) {
|
if (e.getCaught() != null && e.getCaught() instanceof Player) {
|
||||||
Flag flag = us.tastybento.bskyblock.lists.Flags.PVP_OVERWORLD;
|
Flag flag = Flags.PVP_OVERWORLD;
|
||||||
if (e.getCaught().getWorld().equals(getPlugin().getIslandWorldManager().getNetherWorld())) {
|
if (e.getCaught().getWorld().equals(getPlugin().getIslandWorldManager().getNetherWorld())) {
|
||||||
flag = us.tastybento.bskyblock.lists.Flags.PVP_NETHER;
|
flag = Flags.PVP_NETHER;
|
||||||
} else if (e.getCaught().getWorld().equals(getPlugin().getIslandWorldManager().getEndWorld())) {
|
} else if (e.getCaught().getWorld().equals(getPlugin().getIslandWorldManager().getEndWorld())) {
|
||||||
flag = us.tastybento.bskyblock.lists.Flags.PVP_END;
|
flag = Flags.PVP_END;
|
||||||
}
|
}
|
||||||
if (checkIsland(e, e.getCaught().getLocation(), flag)) {
|
if (checkIsland(e, e.getCaught().getLocation(), flag)) {
|
||||||
e.getHook().remove();
|
e.getHook().remove();
|
||||||
@ -91,11 +92,11 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
|
||||||
public void onSplashPotionSplash(final PotionSplashEvent e) {
|
public void onSplashPotionSplash(final PotionSplashEvent e) {
|
||||||
// Deduce the world
|
// Deduce the world
|
||||||
Flag flag = us.tastybento.bskyblock.lists.Flags.PVP_OVERWORLD;
|
Flag flag = Flags.PVP_OVERWORLD;
|
||||||
if (e.getPotion().getWorld().equals(getPlugin().getIslandWorldManager().getNetherWorld())) {
|
if (e.getPotion().getWorld().equals(getPlugin().getIslandWorldManager().getNetherWorld())) {
|
||||||
flag = us.tastybento.bskyblock.lists.Flags.PVP_NETHER;
|
flag = Flags.PVP_NETHER;
|
||||||
} else if (e.getPotion().getWorld().equals(getPlugin().getIslandWorldManager().getEndWorld())) {
|
} else if (e.getPotion().getWorld().equals(getPlugin().getIslandWorldManager().getEndWorld())) {
|
||||||
flag = us.tastybento.bskyblock.lists.Flags.PVP_END;
|
flag = Flags.PVP_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to get the thrower
|
// Try to get the thrower
|
||||||
@ -125,7 +126,7 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
// Try to get the shooter
|
// Try to get the shooter
|
||||||
Projectile projectile = e.getEntity();
|
Projectile projectile = e.getEntity();
|
||||||
if (projectile.getShooter() != null && projectile.getShooter() instanceof Player) {
|
if (projectile.getShooter() != null && projectile.getShooter() instanceof Player) {
|
||||||
UUID uuid = ((Player)projectile.getShooter()).getUniqueId();
|
UUID uuid = ((Player) projectile.getShooter()).getUniqueId();
|
||||||
// Store it and remove it when the effect is gone
|
// Store it and remove it when the effect is gone
|
||||||
thrownPotions.put(e.getAreaEffectCloud().getEntityId(), uuid);
|
thrownPotions.put(e.getAreaEffectCloud().getEntityId(), uuid);
|
||||||
getPlugin().getServer().getScheduler().runTaskLater(getPlugin(), () -> thrownPotions.remove(e.getAreaEffectCloud().getEntityId()), e.getAreaEffectCloud().getDuration());
|
getPlugin().getServer().getScheduler().runTaskLater(getPlugin(), () -> thrownPotions.remove(e.getAreaEffectCloud().getEntityId()), e.getAreaEffectCloud().getDuration());
|
||||||
@ -140,11 +141,11 @@ public class PVPListener extends AbstractFlagListener {
|
|||||||
|
|
||||||
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) {
|
if (e.getCause().equals(DamageCause.ENTITY_ATTACK) && thrownPotions.containsKey(e.getDamager().getEntityId())) {
|
||||||
// Deduce the world
|
// Deduce the world
|
||||||
Flag flag = us.tastybento.bskyblock.lists.Flags.PVP_OVERWORLD;
|
Flag flag = Flags.PVP_OVERWORLD;
|
||||||
if (e.getEntity().getWorld().equals(getPlugin().getIslandWorldManager().getNetherWorld())) {
|
if (e.getEntity().getWorld().equals(getPlugin().getIslandWorldManager().getNetherWorld())) {
|
||||||
flag = us.tastybento.bskyblock.lists.Flags.PVP_NETHER;
|
flag = Flags.PVP_NETHER;
|
||||||
} else if (e.getEntity().getWorld().equals(getPlugin().getIslandWorldManager().getEndWorld())) {
|
} else if (e.getEntity().getWorld().equals(getPlugin().getIslandWorldManager().getEndWorld())) {
|
||||||
flag = us.tastybento.bskyblock.lists.Flags.PVP_END;
|
flag = Flags.PVP_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID attacker = thrownPotions.get(e.getDamager().getEntityId());
|
UUID attacker = thrownPotions.get(e.getDamager().getEntityId());
|
||||||
|
@ -68,7 +68,7 @@ public class FlyingMobEvents implements Listener {
|
|||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void mobSpawn(CreatureSpawnEvent e) {
|
public void onMobSpawn(CreatureSpawnEvent e) {
|
||||||
// Only cover withers in the island world
|
// Only cover withers in the island world
|
||||||
if (!Util.inWorld(e.getEntity())) {
|
if (!Util.inWorld(e.getEntity())) {
|
||||||
return;
|
return;
|
||||||
@ -81,7 +81,7 @@ public class FlyingMobEvents implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void mobExplosion(EntityExplodeEvent e) {
|
public void onMobExplosion(EntityExplodeEvent e) {
|
||||||
// Only cover in the island world
|
// Only cover in the island world
|
||||||
if (e.getEntity() == null || !Util.inWorld(e.getEntity())) {
|
if (e.getEntity() == null || !Util.inWorld(e.getEntity())) {
|
||||||
return;
|
return;
|
||||||
@ -100,7 +100,7 @@ public class FlyingMobEvents implements Listener {
|
|||||||
* Deal with pre-explosions
|
* Deal with pre-explosions
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void witherExplode(ExplosionPrimeEvent e) {
|
public void onWitherExplode(ExplosionPrimeEvent e) {
|
||||||
// Only cover withers in the island world
|
// Only cover withers in the island world
|
||||||
if (!Util.inWorld(e.getEntity()) || e.getEntity() == null) {
|
if (!Util.inWorld(e.getEntity()) || e.getEntity() == null) {
|
||||||
return;
|
return;
|
||||||
@ -115,7 +115,6 @@ public class FlyingMobEvents implements Listener {
|
|||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Testing only e.setCancelled(true);
|
|
||||||
}
|
}
|
||||||
if (e.getEntityType() == EntityType.WITHER_SKULL) {
|
if (e.getEntityType() == EntityType.WITHER_SKULL) {
|
||||||
// Get shooter
|
// Get shooter
|
||||||
@ -140,7 +139,7 @@ public class FlyingMobEvents implements Listener {
|
|||||||
* @param e - event
|
* @param e - event
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void witherChangeBlocks(EntityChangeBlockEvent e) {
|
public void onWitherChangeBlocks(EntityChangeBlockEvent e) {
|
||||||
// Only cover withers in the island world
|
// Only cover withers in the island world
|
||||||
if (e.getEntityType() != EntityType.WITHER || !Util.inWorld(e.getEntity()) ) {
|
if (e.getEntityType() != EntityType.WITHER || !Util.inWorld(e.getEntity()) ) {
|
||||||
return;
|
return;
|
||||||
@ -158,7 +157,7 @@ public class FlyingMobEvents implements Listener {
|
|||||||
* Clean up the hashmap. It's probably not needed, but just in case.
|
* Clean up the hashmap. It's probably not needed, but just in case.
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void mobDeath(EntityDeathEvent e) {
|
public void onMobDeath(EntityDeathEvent e) {
|
||||||
mobSpawnInfo.remove(e.getEntity());
|
mobSpawnInfo.remove(e.getEntity());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -117,12 +117,12 @@ public final class AddonsManager {
|
|||||||
YamlConfiguration data = new YamlConfiguration();
|
YamlConfiguration data = new YamlConfiguration();
|
||||||
data.load(reader);
|
data.load(reader);
|
||||||
// Load the addon
|
// Load the addon
|
||||||
AddonClassLoader loader = new AddonClassLoader(this, data, f, this.getClass().getClassLoader());
|
AddonClassLoader addonClassLoader = new AddonClassLoader(this, data, f, this.getClass().getClassLoader());
|
||||||
// Add to the list of loaders
|
// Add to the list of loaders
|
||||||
this.loader.add(loader);
|
loader.add(addonClassLoader);
|
||||||
|
|
||||||
// Get the addon itself
|
// Get the addon itself
|
||||||
addon = loader.getAddon();
|
addon = addonClassLoader.getAddon();
|
||||||
// Initialize some settings
|
// Initialize some settings
|
||||||
addon.setDataFolder(new File(f.getParent(), addon.getDescription().getName()));
|
addon.setDataFolder(new File(f.getParent(), addon.getDescription().getName()));
|
||||||
addon.setAddonFile(f);
|
addon.setAddonFile(f);
|
||||||
@ -163,12 +163,12 @@ public final class AddonsManager {
|
|||||||
addons.forEach(addon -> {
|
addons.forEach(addon -> {
|
||||||
addon.onDisable();
|
addon.onDisable();
|
||||||
Bukkit.getPluginManager().callEvent(AddonEvent.builder().addon(addon).reason(AddonEvent.Reason.DISABLE).build());
|
Bukkit.getPluginManager().callEvent(AddonEvent.builder().addon(addon).reason(AddonEvent.Reason.DISABLE).build());
|
||||||
System.out.println("Disabling " + addon.getDescription().getName() + "...");
|
plugin.getLogger().info("Disabling " + addon.getDescription().getName() + "...");
|
||||||
});
|
});
|
||||||
|
|
||||||
loader.forEach(loader -> {
|
loader.forEach(l -> {
|
||||||
try {
|
try {
|
||||||
loader.close();
|
l.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
@ -187,7 +187,6 @@ public final class AddonsManager {
|
|||||||
this.loader = loader;
|
this.loader = loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a class by name that has been loaded by this loader
|
* Finds a class by name that has been loaded by this loader
|
||||||
* Code copied from Bukkit JavaPluginLoader
|
* Code copied from Bukkit JavaPluginLoader
|
||||||
@ -200,9 +199,9 @@ public final class AddonsManager {
|
|||||||
if (cachedClass != null) {
|
if (cachedClass != null) {
|
||||||
return cachedClass;
|
return cachedClass;
|
||||||
} else {
|
} else {
|
||||||
for (AddonClassLoader loader : loader) {
|
for (AddonClassLoader l : loader) {
|
||||||
try {
|
try {
|
||||||
cachedClass = loader.findClass(name, false);
|
cachedClass = l.findClass(name, false);
|
||||||
} catch (ClassNotFoundException cnfe) {}
|
} catch (ClassNotFoundException cnfe) {}
|
||||||
if (cachedClass != null) {
|
if (cachedClass != null) {
|
||||||
return cachedClass;
|
return cachedClass;
|
||||||
@ -237,7 +236,7 @@ public final class AddonsManager {
|
|||||||
* @return a list of files
|
* @return a list of files
|
||||||
- if the file cannot be read
|
- if the file cannot be read
|
||||||
*/
|
*/
|
||||||
public List<String> listJarYamlFiles(JarFile jar, String folderPath) throws IOException {
|
public List<String> listJarYamlFiles(JarFile jar, String folderPath) {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -727,14 +727,12 @@ public class IslandsManager {
|
|||||||
homeTeleport(player);
|
homeTeleport(player);
|
||||||
} else {
|
} else {
|
||||||
// Move player to spawn
|
// Move player to spawn
|
||||||
Island spawn = getSpawn();
|
|
||||||
if (spawn != null) {
|
if (spawn != null) {
|
||||||
// go to island spawn
|
// go to island spawn
|
||||||
player.teleport(plugin.getIslandWorldManager().getIslandWorld().getSpawnLocation());
|
player.teleport(plugin.getIslandWorldManager().getIslandWorld().getSpawnLocation());
|
||||||
} else {
|
} else {
|
||||||
if (!player.performCommand(Constants.SPAWNCOMMAND)) {
|
if (!player.performCommand(Constants.SPAWNCOMMAND)) {
|
||||||
plugin.getLogger().warning(()->
|
plugin.getLogger().warning(()-> "During island deletion player " + player.getName() + " could not be sent to spawn so was dropped, sorry.");
|
||||||
"During island deletion player " + player.getName() + " could not be sent to spawn so was dropped, sorry.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,10 +59,7 @@ public class LocalesManager {
|
|||||||
// Describe the filter - we only want files that are correctly named
|
// Describe the filter - we only want files that are correctly named
|
||||||
FilenameFilter ymlFilter = (dir, name) -> {
|
FilenameFilter ymlFilter = (dir, name) -> {
|
||||||
// Files must be 9 chars long
|
// Files must be 9 chars long
|
||||||
if (name.toLowerCase().endsWith(".yml") && name.length() == 9) {
|
return name.toLowerCase().endsWith(".yml") && name.length() == 9;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Run through the files and store the locales
|
// Run through the files and store the locales
|
||||||
|
@ -74,29 +74,24 @@ public class SafeSpotTeleport {
|
|||||||
checking = true;
|
checking = true;
|
||||||
|
|
||||||
// Start a recurring task until done or cancelled
|
// Start a recurring task until done or cancelled
|
||||||
task = plugin.getServer().getScheduler().runTaskTimer(plugin, new Runnable() {
|
task = plugin.getServer().getScheduler().runTaskTimer(plugin, () -> {
|
||||||
|
List<ChunkSnapshot> chunkSnapshot = new ArrayList<>();
|
||||||
@Override
|
if (checking) {
|
||||||
public void run() {
|
Iterator<Pair<Integer, Integer>> it = chunksToScan.iterator();
|
||||||
List<ChunkSnapshot> chunkSnapshot = new ArrayList<>();
|
if (!it.hasNext()) {
|
||||||
if (checking) {
|
// Nothing left
|
||||||
Iterator<Pair<Integer, Integer>> it = chunksToScan.iterator();
|
tidyUp(entity, failureMessage);
|
||||||
if (!it.hasNext()) {
|
return;
|
||||||
// Nothing left
|
|
||||||
tidyUp(entity, failureMessage);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Add chunk snapshots to the list
|
|
||||||
while (it.hasNext() && chunkSnapshot.size() < MAX_CHUNKS) {
|
|
||||||
Pair<Integer, Integer> pair = it.next();
|
|
||||||
chunkSnapshot.add(location.getWorld().getChunkAt(pair.x, pair.z).getChunkSnapshot());
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
// Move to next step
|
|
||||||
checking = false;
|
|
||||||
checkChunks(chunkSnapshot);
|
|
||||||
}
|
}
|
||||||
|
// Add chunk snapshots to the list
|
||||||
|
while (it.hasNext() && chunkSnapshot.size() < MAX_CHUNKS) {
|
||||||
|
Pair<Integer, Integer> pair = it.next();
|
||||||
|
chunkSnapshot.add(location.getWorld().getChunkAt(pair.x, pair.z).getChunkSnapshot());
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
// Move to next step
|
||||||
|
checking = false;
|
||||||
|
checkChunks(chunkSnapshot);
|
||||||
}
|
}
|
||||||
}, 0L, SPEED);
|
}, 0L, SPEED);
|
||||||
}
|
}
|
||||||
@ -119,8 +114,6 @@ public class SafeSpotTeleport {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a set of chunk coords that will be scanned.
|
* Gets a set of chunk coords that will be scanned.
|
||||||
* @param entity
|
|
||||||
* @param location - the location
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private List<Pair<Integer, Integer>> getChunksToScan() {
|
private List<Pair<Integer, Integer>> getChunksToScan() {
|
||||||
|
Loading…
Reference in New Issue
Block a user