Skip to content

Commit

Permalink
feat: add mypet support
Browse files Browse the repository at this point in the history
  • Loading branch information
milkwalk committed Oct 1, 2019
1 parent 5935afb commit aa9de5c
Show file tree
Hide file tree
Showing 27 changed files with 410 additions and 124 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# Change Log
## [3.2.0] - 27/07/2019
### Added
- Vietnamese language (VN) thanks to @fecxica
- MyPets support
- command `/xpb giveDefinedBoost <player/all> <boostId> [durationInSeconds]` - gives a player (or everyone) some predefined boost _(boost does not have to be enabled in the config)_
- ability to choose where you want your messages to appear in the `CHAT` or `ACTIONBAR` for `experienceGainedMessagesOptions` and `activeBoostReminderOptions` settings

### Changed

- renamed some configuration keys for better readability **(you may want to regenerate your config file)**

## [3.1.0] - 3/06/2019

Expand Down
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cz.dubcat.plugins</groupId>
<artifactId>xpboost</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
<name>XPBoost</name>

<properties>
Expand Down Expand Up @@ -79,6 +79,10 @@
<id>inventive-repo</id>
<url>https://repo.inventivetalent.org/content/groups/public/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
Expand Down Expand Up @@ -195,6 +199,13 @@
<version>3.108</version>
<scope>provided</scope>
</dependency>
<!-- MyPet -->
<dependency>
<groupId>de.keyle.mypet</groupId>
<artifactId>mypet</artifactId>
<version>3.5</version>
<scope>provided</scope>
</dependency>
<!-- Jobs -->
<dependency>
<groupId>jobs.reborn</groupId>
Expand Down
3 changes: 2 additions & 1 deletion resources/boosts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# RPGME: false #|Same but for rgme
# HEROES: false #|Same but for heroes
# JOBS: false #|Same but for JobsReborn
# MYPET: true #|Same but for MyPet
# advanced: *OPTIONAL*
# //Here you can set specifically what kind of exp you want to be affected for each supported plugin.
# //The format is:
Expand All @@ -38,7 +39,6 @@
# MCMMO:
# default: false //disabling everyhting by default
# swords: true //enabling swords experience
#

boost1:
enabled: true
Expand All @@ -60,6 +60,7 @@ boost1:
HEROES: true
JOBS: true
MCMMO: true
MYPET: true
advanced:
#Here you can choose specifically what kind of experience will be affected by the boost
SKILLAPI: #this boost will ignore crafting experience from SKILLAPI
Expand Down
41 changes: 28 additions & 13 deletions resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ database:

settings:
config_version: 1
#Supported languages: ENG (English) | NL (Dutch) | ZHS (Simplified Chinese)
#Supported languages: ENG (English) | NL (Dutch) | ZHS (Simplified Chinese) | VN (Vietnamese)
#If you've got a translation to some other language send it to me :)
language: 'ENG'
#Enable debug 0 = disabled | 1 = Normal | 2 = All information (Mostly useless for you)
Expand All @@ -33,16 +33,26 @@ settings:
multiplier: 2.0
#Enable/disable notification on join when global boost is active
notification: true
#Do you want the message about XP gain to appear
doublexpmsg: true
#Actionban message time delay in ticks, (20 ticks = 1 sec) default 5 sec
actiondelay: 100
# Disable/Enable vanilla experience gain message
enableVanillaExperienceGainedMessage: true
# These settings apply to ALL messages about gained experience (vanilla, mcmmo and etc.)
experienceGainedMessagesOptions:
# You can completely disable ALL messages about gained experience by setting this to false
enabled: true
# Where messages should appear? This can be CHAT or ACTIONBAR
location: 'CHAT'
activeBoostReminderOptions:
# Do you want active xpboost reminder to be enabled?
enabled: true
# How ofter do you want players to be reminded about an active xpboost?
# This value is in ticks (20 ticks = 1 sec) default 5 sec
periodInTicks: 100
# Where reminder about active xpboost should appear? This can be CHAT or ACTIONBAR
location: 'ACTIONBAR'
#Enable/disable motd when global boost is active
motdon: true
#Boost end sound - the sound that is emitted when the boost ends
boostEndSound: BLOCK_TRIPWIRE_CLICK_OFF
#Enable/disable actionbar message when boost is active
actionbarmsg: true
bossbar:
#Enable/disable bossbar when boost is active (will work only if BossBar plugin is present)
bossbarmsg: true
Expand All @@ -69,26 +79,26 @@ settings:
friday: false
saturday: false
sunday: false
#Disabled commands while XPBoost is active
# Disabled commands while XPBoost is active
disabledcommands:
#Do you want this feature to be enabled?
enabled: true
#List of forbiden commands while XPBoost is active
#List of forbidden commands while XPBoost is active
list:
- '/give'
- '/test'
#Put it to true if you are using daily global xpboost and ur server does not restart every day
#Put this to true if you are using daily global xpboost and your server does not restart every day
periodicalDayCheck: false
#McMMO support
mcmmo:
msg:
enabled: true #do you want a message below to appear?
enabled: true #do you want the message below to appear?
msg: '&aGained &c%newexp% &aXP instead of &c%oldexp%&a. Skill: &c%skill%'
#RPGme support
rpgme:
msg:
enabled: true
#I disabled message for a STAMINA skill cuz it just spamms rly a lot
# STAMINA skill is ignored (too much spam)
msg: '&aGained &c%newexp% &aXP instead of &c%oldexp%&a. Skill: &c%skill%'
#Heroes support
heroes:
Expand All @@ -99,4 +109,9 @@ settings:
jobs:
msg:
enabled: true
msg: '&aGained &c%newexp% &aXP instead of &c%oldexp%&a. Job: &c%job%'
msg: '&aGained &c%newexp% &aXP instead of &c%oldexp%&a. Job: &c%job%'
#MyPet support
mypet:
msg:
enabled: true
msg: '&aYour pet has gained &c%newexp% &aXP instead of &c%oldexp%&a.'
44 changes: 44 additions & 0 deletions resources/lang/lang_VN.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
lang:
prefix: '&f[&aXPBoost&f] '
doublexpnot: '&fBạn Nhận Được &a%newexp% XP &fThay Vì &a%oldexp% XP'
actionbar: '&a%boost%x Tăng XP Đã Được Kích Hoạt'
bossbar: '&a%boost%x Tăng XP Đã Được Kích Hoạt'
motd: "&c%boost%x &aNhân XP Đã Được Bật! Tham Gia Ngay! \n &f&lĐây Là Dòng Thứ Hai!\
\ &c%players%/%max%"
boostfisnish: '&cTăng XP Đã Hết Hạn.'
boostcountdown: '&fSố Giây Còn Lại: &6'
boostinfodeny: '&fBạn Chưa Sử Dụng Tăng XP Nào.'
xpbuy: '&cTăng XP %boost%x &f &fĐã Bật Trong &a%time% Giây &c(%money%$).'
gui: '&cCửa Hàng Tăng XP'
xptitle: '&aTăng XP %boost%x.'
boostlore:
- '&cTăng XP %boost%x Trong %time% Giây'
- '&aGiá: &f&l%money%$'
buyfail: '&cBạn Không Đủ Tiền Để Mua! &a(%money%$)'
boostactive: '&cTăng XP Vẫn Đang Được Kích Hoạt!'
joinnotmsg: '&f&lTăng XP %boost%x Được &f&aKích Hoạt &f&lCho Tất Cả Mọi Người!'
cmdblock: '&cBạn Không Có Quyền &a%cmd% &cTrong Khi Tăng XP Đang Kích Hoạt:('
itemname: '&aTăng XP %boost%x'
factions_gui_name: '&cCửa Hàng Tăng XP (Factions)'
factions_nofaction: '&cBạn Chưa Có Trong Factions Nào Cả.'
factions_active_boost: Faction của bạn đã có Tăng XP Từ Trước!
factions_only_owners: Chỉ Có Chủ Faction Mới Có Thể Mua Tăng XP!
factions_expire: '&cTăng XP Của Faction Đã Hết Hạn!'
factions_buy: '&c%player% &fVừa Mua Tăng XP &c%boost%x &fCho Faction Trong &c%time% Giây!'
factions_one_boost: Bạn Không Thể Mua Thêm Trong Khi Đang Kích Hoạt Tăng XP.
item:
lore1: '&fTăng XP: &a%boost%x'
lore2: '&fThời Hạn: &a%time% Seconds'
lore3: '&8Chuột Phải Để Lấy.'
reload: '&fConfig Đã Được Tải Lại'
pluginmenu:
- /xpboost gui &f- Mở GUI
- /xpboost info &f- Thời Gian Tăng XP Còn Lại
- /xpboost factions &f- Mở GUI Factions
- /xpboost on/off &f - Bật/Tắt Tăng XP Cho Tất Cả
- /xpboost give <tên/all> <tăng> <thời lượng> [VANILLA,SKILLAPI,MCMMO,RPGME,HEROES]&f - Cung cấp cho người chơi tăng XP
- /xpboost clear <tên> &f - Xóa tất cả Tăng XP Của Người Chơi
- /xpboost item <player> <boost> <time>&f - Đưa Vật Phẩm Tăng XP Cho Người Chơi
- /xpboost global <boost> [time in seconds]- Thay Đổi Tăng XP Cho Tất Cả
- /xpboost reload &f - Tải Lại Config
- Trong Dấu [] là &ckhông bắt buộc
1 change: 1 addition & 0 deletions resources/lang_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ lang:
- /xpboost factions &f- Opens up a factions GUI
- /xpboost on/off &f - Enables/disables global XP Boost
- /xpboost give <name/all> <boost> <time> [VANILLA,SKILLAPI,MCMMO,RPGME,HEROES]&f - Gives player boost
- /xpboost giveDefinedBoost <player/all> <boostId> [durationInSeconds]&f - Gives a predefined boost
- /xpboost clear <name> &f - Clears active boost
- /xpboost item <player> <boost> <time>&f - Gives an XPboost item to a player
- /xpboost global <boost> [time in seconds]- Changes global boost multiplier
Expand Down
33 changes: 21 additions & 12 deletions src/cz/dubcat/xpboost/XPBoostMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import be.maximvdw.placeholderapi.PlaceholderAPI;
import cz.dubcat.xpboost.api.MainAPI;
import cz.dubcat.xpboost.api.XPBoostAPI;
import cz.dubcat.xpboost.api.messages.ExperienceNotifier;
import cz.dubcat.xpboost.commands.ClearCommand;
import cz.dubcat.xpboost.commands.CommandHandler;
import cz.dubcat.xpboost.commands.GiveBoostCommand;
import cz.dubcat.xpboost.commands.GiveDefinedBoostCommand;
import cz.dubcat.xpboost.commands.GlobalCommand;
import cz.dubcat.xpboost.commands.GlobalDisableCommand;
import cz.dubcat.xpboost.commands.GlobalEnableCommand;
Expand All @@ -41,11 +43,11 @@
import cz.dubcat.xpboost.constructors.GlobalBoost;
import cz.dubcat.xpboost.constructors.XPBoost;
import cz.dubcat.xpboost.events.CommandListener;
import cz.dubcat.xpboost.events.ExpListener;
import cz.dubcat.xpboost.events.ExpRestrictions;
import cz.dubcat.xpboost.events.JoinAndQuitEvent;
import cz.dubcat.xpboost.events.ServerList;
import cz.dubcat.xpboost.events.Signs;
import cz.dubcat.xpboost.events.ExperienceRestrictions;
import cz.dubcat.xpboost.events.PlayerExperienceChangeListener;
import cz.dubcat.xpboost.events.PlayerJoinAndQuitEvent;
import cz.dubcat.xpboost.events.ServerListListener;
import cz.dubcat.xpboost.events.SignsClickListener;
import cz.dubcat.xpboost.events.XpBoostItemListener;
import cz.dubcat.xpboost.gui.ShopClickListener;
import cz.dubcat.xpboost.support.BossBarN;
Expand Down Expand Up @@ -74,6 +76,7 @@ public class XPBoostMain extends JavaPlugin {
public static FileConfiguration lang;
public static File boostFile;
public static FileConfiguration boostCfg;
private ExperienceNotifier experienceNotifier;

@Override
public void onEnable() {
Expand Down Expand Up @@ -104,6 +107,7 @@ public void onEnable() {
}

this.copyLangFiles();
experienceNotifier = new ExperienceNotifier();

// language
if (getConfig().contains("settings.language")) {
Expand Down Expand Up @@ -207,16 +211,16 @@ public void onEnable() {

registerCommands();
new XPBoostTask().runTaskTimerAsynchronously(this, 0, 5);
new ActionBarTask().runTaskTimerAsynchronously(this, 100, getConfig().getLong("settings.actiondelay"));
new ActionBarTask().runTaskTimerAsynchronously(this, 100, getConfig().getLong("settings.activeBoostReminderOptions.periodInTicks"));

// register events
getServer().getPluginManager().registerEvents(new ExpListener(), this);
getServer().getPluginManager().registerEvents(new JoinAndQuitEvent(), this);
getServer().getPluginManager().registerEvents(new ServerList(), this);
getServer().getPluginManager().registerEvents(new PlayerExperienceChangeListener(), this);
getServer().getPluginManager().registerEvents(new PlayerJoinAndQuitEvent(), this);
getServer().getPluginManager().registerEvents(new ServerListListener(), this);
getServer().getPluginManager().registerEvents(new CommandListener(), this);
getServer().getPluginManager().registerEvents(new ShopClickListener(), this);
getServer().getPluginManager().registerEvents(new Signs(), this);
getServer().getPluginManager().registerEvents(new ExpRestrictions(), this);
getServer().getPluginManager().registerEvents(new SignsClickListener(), this);
getServer().getPluginManager().registerEvents(new ExperienceRestrictions(), this);
getServer().getPluginManager().registerEvents(new XpBoostItemListener(), this);

// Auto global boost task
Expand Down Expand Up @@ -254,7 +258,7 @@ public void onDisable() {
getLogger().info("Disabled.");
}

public static Plugin getPlugin() {
public static XPBoostMain getPlugin() {
return plugin;
}

Expand All @@ -265,6 +269,10 @@ public static FileConfiguration getLang() {
public static Logger getLog() {
return Bukkit.getLogger();
}

public ExperienceNotifier getExperienceNotifier() {
return this.experienceNotifier;
}

public Debug reloadDebug() {
int debug = XPBoostMain.getPlugin().getConfig().getInt("settings.debug");
Expand Down Expand Up @@ -300,6 +308,7 @@ private void registerCommands() {
handler.register("clear", new ClearCommand());
handler.register("item", new ItemCommand(this));
handler.register("global", new GlobalCommand(this));
handler.register("giveDefinedBoost", new GiveDefinedBoostCommand());

getCommand("xpboost").setExecutor(handler);
getCommand("xpb").setExecutor(handler);
Expand Down
Loading

0 comments on commit aa9de5c

Please sign in to comment.