Browse Source

added support for 1.14, fixed #35, #36

MasterCake 5 years ago
parent
commit
2da660c9f7

+ 13 - 13
Plugin/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -66,7 +66,7 @@
         <dependency>
             <groupId>org.spigotmc</groupId>
             <artifactId>spigot-api</artifactId>
-            <version>1.12.2-R0.1-SNAPSHOT</version>
+            <version>1.14.1-R0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -83,57 +83,57 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_8_R1</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_8_R2</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_8_R3</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_9_R1</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_9_R2</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_10_R1</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_11_R1</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_12_R1</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_13_R1</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>v1_13_R2</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 11 - 11
Plugin/src/main/java/de/Linus122/TimeIsMoney/ATM.java

@@ -202,7 +202,7 @@ public class ATM implements Listener, CommandExecutor {
 	@EventHandler(priority = EventPriority.HIGHEST)
 	public void onInteract(PlayerInteractEvent e) {
 		if (e.getClickedBlock() != null) {
-			if (e.getClickedBlock().getType() == Material.WALL_SIGN || e.getClickedBlock().getType() == Material.SIGN || e.getClickedBlock().getType() == Material.SIGN_POST) {
+			if (e.getClickedBlock().getType() == Material.getMaterial("WALL_SIGN") || e.getClickedBlock().getType() == Material.getMaterial("SIGN") || e.getClickedBlock().getType() == Material.getMaterial("SIGN_POST")) {
 				Sign sign = (Sign) e.getClickedBlock().getState();
 				if (sign.getLine(0).equalsIgnoreCase(CC("&cATM"))) {
 					if (!e.getPlayer().hasPermission("tim.atm.use")) {
@@ -218,8 +218,8 @@ public class ATM implements Listener, CommandExecutor {
 	@EventHandler
 	public void onMove(InventoryMoveItemEvent e) {
 		if (e.getSource() == null) return;
-		if (e.getSource().getTitle() == null) return;
-		if (e.getSource().getTitle().equals(CC(Main.finalconfig.getString("atm_title")))) {
+		if (e.getSource().getViewers().get(0).getOpenInventory().getTitle() == null) return;
+		if (e.getSource().getViewers().get(0).getOpenInventory().getTitle().equals(CC(Main.finalconfig.getString("atm_title")))) {
 			e.setCancelled(true);
 		}
 	}
@@ -230,8 +230,8 @@ public class ATM implements Listener, CommandExecutor {
 		try {
 			if (e == null) return;
 			if (e.getInventory() == null) return;
-			if (e.getInventory().getTitle() == null) return;
-			if (e.getInventory().getTitle().equals(CC(Main.finalconfig.getString("atm_title")))) {
+			if (e.getView().getTitle() == null) return;
+			if (e.getView().getTitle().equals(CC(Main.finalconfig.getString("atm_title")))) {
 				e.setResult(Result.DENY);
 				Player p = (Player) e.getWhoClicked();
 				//e.setCancelled(true);
@@ -293,7 +293,7 @@ public class ATM implements Listener, CommandExecutor {
 		atm_gui.setItem(4, is);
 		
 		// Withdraw
-		is = new ItemStack(Material.CLAY_BRICK, 1);
+		is = new ItemStack(Material.getMaterial("CLAY_BRICK"), 1);
 		im = is.getItemMeta();
 		im.setDisplayName(CC(Main.finalconfig.getString("atm_withdraw") + " &a") + Main.economy.format(worths[0]));
 		is.setItemMeta(im);
@@ -318,7 +318,7 @@ public class ATM implements Listener, CommandExecutor {
 		atm_gui.setItem(0, is);
 		
 		// Deposit
-		is = new ItemStack(Material.CLAY_BRICK, 1);
+		is = new ItemStack(Material.getMaterial("CLAY_BRICK"), 1);
 		im = is.getItemMeta();
 		im.setDisplayName(CC(Main.finalconfig.getString("atm_deposit") + " &4") + Main.economy.format(worths[0]));
 		is.setItemMeta(im);
@@ -352,8 +352,8 @@ public class ATM implements Listener, CommandExecutor {
 	public void onInventoryDrag(InventoryDragEvent e) {
 		if (e == null) return;
 		if (e.getInventory() == null) return;
-		if (e.getInventory().getTitle() == null) return;
-		if (e.getInventory().getTitle().equals(CC(Main.finalconfig.getString("atm_title")))) {
+		if (e.getView().getTitle() == null) return;
+		if (e.getView().getTitle().equals(CC(Main.finalconfig.getString("atm_title")))) {
 			e.setResult(Result.DENY);
 		}
 	}
@@ -361,9 +361,9 @@ public class ATM implements Listener, CommandExecutor {
 	@EventHandler
 	public void onSignChange(final SignChangeEvent e) {
 		final Block b = e.getBlock();
-		if (b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN || b.getType() == Material.SIGN_POST) {
+		if (b.getType() == Material.getMaterial("WALL_SIGN") || b.getType() == Material.getMaterial("SIGN") || b.getType() == Material.getMaterial("SIGN_POST")) {
 			plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
-				if (b.getType() == Material.WALL_SIGN || b.getType() == Material.SIGN || b.getType() == Material.SIGN_POST) {
+				if (b.getType() == Material.getMaterial("WALL_SIGN") || b.getType() == Material.getMaterial("SIGN") || b.getType() == Material.getMaterial("SIGN_POST")) {
 					Sign sign = (Sign) e.getBlock().getState();
 					if (sign.getLine(0).equalsIgnoreCase("[atm]")) {
 						if (!e.getPlayer().hasPermission("tim.atm.place")) {

+ 1 - 1
Plugin/src/main/java/de/Linus122/TimeIsMoney/Main.java

@@ -149,7 +149,7 @@ public class Main extends JavaPlugin {
 		if (getConfig().getBoolean("enable_atm")) new ATM(this);
 		
 		final int seconds = getConfig().getInt("give_money_every_second");
-		Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
+		Bukkit.getScheduler().runTaskTimer(this, () -> {
 			try {
 				for (Player p : Bukkit.getOnlinePlayers()) {
 					if (disabledWorlds.contains(p.getWorld().getName())) continue;

+ 3 - 1
README.md

@@ -4,8 +4,10 @@
 
 ![resource icon](https://www.spigotmc.org/data/resource_icons/12/12409.jpg?1442674788)
 
+[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5ATDE93C6J3WE&source=url)
+
 ## Welcome to the TimeIsMoney GitHub repository!
-TimeIsMoney is a Spigot plugin compatible with Spigot versions 1.7 through 1.12.2, that gives players money for their time online!
+TimeIsMoney is a Spigot plugin compatible with Spigot versions 1.7 through 1.14.*, that gives players money for their time online!
 
 In order for everyone to have the best experience possible, we have a few guidelines that everyone must follow.    
 - For all things on GitHub, please make sure you follow the [code of conduct](CODE_OF_CONDUCT.md).  

+ 1 - 1
Tools/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 

+ 2 - 1
pom.xml

@@ -6,7 +6,7 @@
 
     <groupId>de.Linus122.TimeIsMoney</groupId>
     <artifactId>parent</artifactId>
-    <version>1.9.6.5</version>
+    <version>1.9.6.6</version>
     <name>TimeIsMoney Parent</name>
     <url>https://www.spigotmc.org/resources/time-is-money.12409/</url>
     <packaging>pom</packaging>
@@ -28,6 +28,7 @@
         <module>v1_12_R1</module>
         <module>v1_13_R1</module>
         <module>v1_13_R2</module>
+        <module>v1_14_R1</module>
     </modules>
 
     <repositories>

+ 2 - 2
v1_10_R1/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 2 - 2
v1_11_R1/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 2 - 2
v1_12_R1/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 2 - 2
v1_13_R1/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 2 - 2
v1_13_R2/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 41 - 0
v1_14_R1/pom.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>de.Linus122.TimeIsMoney</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.9.6.6</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <name>TimeIsMoney v1_14_R1</name>
+    <packaging>jar</packaging>
+    <artifactId>v1_14_R1</artifactId>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.spigotmc</groupId>
+            <artifactId>spigot-api</artifactId>
+            <version>1.14.1-R0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.bukkit</groupId>
+            <artifactId>craftbukkit</artifactId>
+            <version>1.14.1-R0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>de.Linus122.TimeIsMoney</groupId>
+            <artifactId>Tools</artifactId>
+            <version>1.9.6.6</version>
+        </dependency>
+    </dependencies>
+</project>

+ 28 - 0
v1_14_R1/src/main/java/de/Linus122/TimeIsMoney/version/v1_14_R1/NBTUtils.java

@@ -0,0 +1,28 @@
+package de.Linus122.TimeIsMoney.version.v1_14_R1;
+
+import de.Linus122.TimeIsMoney.tools.ActionBarUtils;
+import net.minecraft.server.v1_14_R1.ChatMessageType;
+import net.minecraft.server.v1_14_R1.IChatBaseComponent;
+import net.minecraft.server.v1_14_R1.PacketPlayOutChat;
+import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+import static de.Linus122.TimeIsMoney.tools.Utils.CC;
+
+/**
+ * NBT Utils for v1_13_R1.
+ *
+ * @author Linus122
+ * @since 1.9.6.4
+ */
+public class NBTUtils implements ActionBarUtils {
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public void sendActionBarMessage(Player p, String message) {
+		IChatBaseComponent icbc = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + CC(message) + "\"}");
+		PacketPlayOutChat bar = new PacketPlayOutChat(icbc, ChatMessageType.GAME_INFO);
+		((CraftPlayer) p).getHandle().playerConnection.sendPacket(bar);
+	}
+}

+ 2 - 2
v1_8_R1/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 2 - 2
v1_8_R2/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 2 - 2
v1_8_R3/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 2 - 2
v1_9_R1/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>

+ 2 - 2
v1_9_R2/pom.xml

@@ -7,7 +7,7 @@
     <parent>
         <groupId>de.Linus122.TimeIsMoney</groupId>
         <artifactId>parent</artifactId>
-        <version>1.9.6.5</version>
+        <version>1.9.6.6</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
@@ -35,7 +35,7 @@
         <dependency>
             <groupId>de.Linus122.TimeIsMoney</groupId>
             <artifactId>Tools</artifactId>
-            <version>1.9.6.5</version>
+            <version>1.9.6.6</version>
         </dependency>
     </dependencies>
 </project>