Skip to content

Commit

Permalink
feat: updated to mc 1.14.2
Browse files Browse the repository at this point in the history
  • Loading branch information
milkwalk committed Jun 3, 2019
1 parent 488cabd commit 98bf400
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 35 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [3.1.0] - 3/06/2019

### Added
- support for Minecraft 1.14.2

### Changed
- inventory recognition using `InventoryHolder`

## [3.0.2] - 3/02/2019

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You will need to have Dubcat public repository added to your `pom.xml` under `<r
<!-- Dubcat Repository -->
<repository>
<id>dubcat-repo</id>
<url>http://maven.apps.dubcat.cz/repository/dubcat-public/</url>
<url>https://maven.dubcat.cz/repository/dubcat-public/</url>
</repository>
```

Expand Down
72 changes: 53 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@
<modelVersion>4.0.0</modelVersion>
<groupId>cz.dubcat.plugins</groupId>
<artifactId>xpboost</artifactId>
<version>3.0.2</version>

<version>3.1.0</version>
<name>XPBoost</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -21,25 +29,45 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>commons-io:commons-io</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<distributionManagement>
<repository>
<id>dubcat-public</id>
<url>http://maven.apps.dubcat.cz/repository/dubcat-public/</url>
<url>https://maven.dubcat.cz/repository/dubcat-public/</url>
</repository>
<snapshotRepository>
<id>dubcat-public</id>
<url>http://maven.apps.dubcat.cz/repository/dubcat-public/</url>
<url>https://maven.dubcat.cz/repository/dubcat-public/</url>
</snapshotRepository>
</distributionManagement>

<repositories>
<!-- Dubcat Public Repository -->
<repository>
<id>dubcat-public</id>
<url>http://maven.apps.dubcat.cz/repository/dubcat-public/</url>
<id>dubcat-public</id>
<url>https://maven.dubcat.cz/repository/dubcat-public/</url>
</repository>
<!-- MVdW -->
<repository>
Expand All @@ -52,14 +80,14 @@
<url>https://repo.inventivetalent.org/content/groups/public/</url>
</repository>
</repositories>

<dependencies>
<!-- Spigot -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- MVdWPlaceholderAPI -->
<dependency>
Expand Down Expand Up @@ -95,6 +123,12 @@
<version>1.18.2</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- Heroes -->
<dependency>
<groupId>com.herocraftonline.heroes</groupId>
Expand Down Expand Up @@ -154,14 +188,14 @@
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<!-- Skillapi -->
<!-- Skillapi -->
<dependency>
<groupId>com.github.Eniripsa96</groupId>
<artifactId>skillapi</artifactId>
<version>3.108</version>
<scope>provided</scope>
</dependency>
<!-- Jobs -->
<!-- Jobs -->
<dependency>
<groupId>jobs.reborn</groupId>
<artifactId>jobs</artifactId>
Expand All @@ -170,9 +204,9 @@
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
</project>
6 changes: 3 additions & 3 deletions resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: XPBoost
author: Qifi (elving21)
version: 3.0.1
name: ${project.name}
author: milkwalk
version: ${project.version}
main: cz.dubcat.xpboost.XPBoostMain
commands:
xpboost:
Expand Down
4 changes: 2 additions & 2 deletions src/cz/dubcat/xpboost/XPBoostMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import cz.dubcat.xpboost.events.ServerList;
import cz.dubcat.xpboost.events.Signs;
import cz.dubcat.xpboost.events.XpBoostItemListener;
import cz.dubcat.xpboost.gui.ClickListener;
import cz.dubcat.xpboost.gui.ShopClickListener;
import cz.dubcat.xpboost.support.BossBarN;
import cz.dubcat.xpboost.support.Heroes;
import cz.dubcat.xpboost.support.JobsReborn;
Expand Down Expand Up @@ -214,7 +214,7 @@ public void onEnable() {
getServer().getPluginManager().registerEvents(new JoinAndQuitEvent(), this);
getServer().getPluginManager().registerEvents(new ServerList(), this);
getServer().getPluginManager().registerEvents(new CommandListener(), this);
getServer().getPluginManager().registerEvents(new ClickListener(), this);
getServer().getPluginManager().registerEvents(new ShopClickListener(), this);
getServer().getPluginManager().registerEvents(new Signs(), this);
getServer().getPluginManager().registerEvents(new ExpRestrictions(), this);
getServer().getPluginManager().registerEvents(new XpBoostItemListener(), this);
Expand Down
3 changes: 2 additions & 1 deletion src/cz/dubcat/xpboost/api/MainAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import cz.dubcat.xpboost.constructors.Database.DType;
import cz.dubcat.xpboost.constructors.Debug;
import cz.dubcat.xpboost.constructors.XPBoost;
import cz.dubcat.xpboost.constructors.XPBoostInventoryHolder;
import cz.dubcat.xpboost.utils.DbUtils;
import cz.dubcat.xpboost.utils.PlayerDataManager;
import cz.dubcat.xpboost.utils.XMaterial;
Expand Down Expand Up @@ -377,7 +378,7 @@ public static void openXpBoostShop(Player player) {
amount = 9;
}

Inventory GUI = Bukkit.createInventory(null, amount, colorizeText(XPBoostMain.getLang().getString("lang.gui")));
Inventory GUI = Bukkit.createInventory(new XPBoostInventoryHolder(), amount, colorizeText(XPBoostMain.getLang().getString("lang.gui")));
for (String key : XPBoostMain.boostCfg.getConfigurationSection("").getKeys(false)) {
if (XPBoostMain.boostCfg.getBoolean(key + ".enabled") == true) {
i++;
Expand Down
13 changes: 13 additions & 0 deletions src/cz/dubcat/xpboost/constructors/XPBoostInventoryHolder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cz.dubcat.xpboost.constructors;

import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;

public class XPBoostInventoryHolder implements InventoryHolder {

@Override
public Inventory getInventory() {
return null;
}

}
4 changes: 1 addition & 3 deletions src/cz/dubcat/xpboost/events/Signs.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cz.dubcat.xpboost.events;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -47,8 +46,7 @@ public void onInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
Player player = event.getPlayer();
Action action = event.getAction();
if (action == Action.RIGHT_CLICK_BLOCK && (block.getState().getType() == XMaterial.WALL_SIGN.parseMaterial()
|| block.getState().getType() == Material.WALL_SIGN)) {
if (action == Action.RIGHT_CLICK_BLOCK && (block.getState().getType() == XMaterial.WALL_SIGN.parseMaterial())) {
Sign sign = (Sign) block.getState();
if (sign.getLine(0).equalsIgnoreCase(
MainAPI.colorizeText(XPBoostMain.getPlugin().getConfig().getString("settings.sign.line1")))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@
import cz.dubcat.xpboost.api.BoostAPI;
import cz.dubcat.xpboost.api.MainAPI;
import cz.dubcat.xpboost.api.XPBoostAPI;
import cz.dubcat.xpboost.constructors.XPBoostInventoryHolder;

public class ClickListener implements Listener {

public class ShopClickListener implements Listener {
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
String inventoryName = MainAPI.colorizeText(XPBoostMain.getLang().getString("lang.gui"));

if (event.getInventory().getName().equals(inventoryName)) {
if (event.getInventory().getHolder() instanceof XPBoostInventoryHolder) {
Player player = (Player) event.getWhoClicked();
UUID playerUuid = player.getUniqueId();
ItemStack clickedItem = event.getCurrentItem();
int slot = event.getSlot();
Expand Down

0 comments on commit 98bf400

Please sign in to comment.