Massive Refactoring + adding 1.14 support
Dieser Commit ist enthalten in:
Ursprung
3e31762fe6
Commit
6244c79b63
37
SpigotCore_12/pom.xml
Normale Datei
37
SpigotCore_12/pom.xml
Normale Datei
@ -0,0 +1,37 @@
|
||||
<?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>steamwar</groupId>
|
||||
<artifactId>SpigotCore</artifactId>
|
||||
<version>2.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>SpigotCore_12</artifactId>
|
||||
<version>2.0</version>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
<exclude>**/*.kt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot-1.12</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
13
SpigotCore_12/src/de/steamwar/inventory/SWInventory_v12.java
Normale Datei
13
SpigotCore_12/src/de/steamwar/inventory/SWInventory_v12.java
Normale Datei
@ -0,0 +1,13 @@
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
class SWInventory_v12 {
|
||||
private SWInventory_v12(){}
|
||||
|
||||
static Inventory get(Player player, int size, String title){
|
||||
return new CraftInventoryCustom(player, size, title);
|
||||
}
|
||||
}
|
@ -8,4 +8,8 @@ class SWItem_v12 {
|
||||
static Material getMaterial(String material){
|
||||
return Material.valueOf(material);
|
||||
}
|
||||
|
||||
static Material getDye(){
|
||||
return Material.INK_SACK;
|
||||
}
|
||||
}
|
37
SpigotCore_14/pom.xml
Normale Datei
37
SpigotCore_14/pom.xml
Normale Datei
@ -0,0 +1,37 @@
|
||||
<?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>steamwar</groupId>
|
||||
<artifactId>SpigotCore</artifactId>
|
||||
<version>2.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>SpigotCore_14</artifactId>
|
||||
<version>2.0</version>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
<exclude>**/*.kt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot-1.14</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
13
SpigotCore_14/src/de/steamwar/inventory/SWInventory_v14.java
Normale Datei
13
SpigotCore_14/src/de/steamwar/inventory/SWInventory_v14.java
Normale Datei
@ -0,0 +1,13 @@
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
class SWInventory_v14 {
|
||||
private SWInventory_v14() {}
|
||||
|
||||
static Inventory get(Player player, int size, String title){
|
||||
return new CraftInventoryCustom(player, size, title);
|
||||
}
|
||||
}
|
48
SpigotCore_14/src/de/steamwar/inventory/SWItem_v14.java
Normale Datei
48
SpigotCore_14/src/de/steamwar/inventory/SWItem_v14.java
Normale Datei
@ -0,0 +1,48 @@
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
class SWItem_v14 {
|
||||
private SWItem_v14(){}
|
||||
|
||||
static Material getMaterial(String material) {
|
||||
return Material.valueOf("LEGACY_" + material);
|
||||
}
|
||||
|
||||
static Material getDye(int colorCode){
|
||||
switch(colorCode){
|
||||
case 1:
|
||||
return Material.RED_DYE;
|
||||
case 2:
|
||||
return Material.GREEN_DYE;
|
||||
case 3:
|
||||
return Material.BROWN_DYE;
|
||||
case 4:
|
||||
return Material.LAPIS_LAZULI;
|
||||
case 5:
|
||||
return Material.PURPLE_DYE;
|
||||
case 6:
|
||||
return Material.CYAN_DYE;
|
||||
case 7:
|
||||
return Material.LIGHT_GRAY_DYE;
|
||||
case 8:
|
||||
return Material.GRAY_DYE;
|
||||
case 9:
|
||||
return Material.PINK_DYE;
|
||||
case 10:
|
||||
return Material.LIME_DYE;
|
||||
case 11:
|
||||
return Material.YELLOW_DYE;
|
||||
case 12:
|
||||
return Material.LIGHT_BLUE_DYE;
|
||||
case 13:
|
||||
return Material.MAGENTA_DYE;
|
||||
case 14:
|
||||
return Material.ORANGE_DYE;
|
||||
case 15:
|
||||
return Material.WHITE_DYE;
|
||||
default:
|
||||
return Material.BLACK_DYE;
|
||||
}
|
||||
}
|
||||
}
|
68
SpigotCore_Main/pom.xml
Normale Datei
68
SpigotCore_Main/pom.xml
Normale Datei
@ -0,0 +1,68 @@
|
||||
<?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>steamwar</groupId>
|
||||
<artifactId>SpigotCore</artifactId>
|
||||
<version>2.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>SpigotCore_Main</artifactId>
|
||||
<version>2.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
<exclude>**/*.kt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot-1.12</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>SpigotCore_12</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>SpigotCore_14</artifactId>
|
||||
<version>2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,6 +1,5 @@
|
||||
package de.steamwar.core.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
@ -9,7 +8,6 @@ public class ChattingEvent implements Listener {
|
||||
|
||||
@EventHandler
|
||||
private void onChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
event.setFormat("§eLokal §r"+ player.getDisplayName() + "§8» §7" + event.getMessage());
|
||||
event.setFormat("§eLokal §r"+ event.getPlayer().getDisplayName() + "§8» §7" + event.getMessage());
|
||||
}
|
||||
}
|
@ -26,10 +26,10 @@ public class SWInventory implements Listener {
|
||||
player = p;
|
||||
switch(Core.getVersion()){
|
||||
case 14:
|
||||
inventory = new SWInventory_v14(p, size, t);
|
||||
inventory = SWInventory_v14.get(p, size, t);
|
||||
break;
|
||||
default:
|
||||
inventory = new SWInventory_v12(p, size, t);
|
||||
inventory = SWInventory_v12.get(p, size, t);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ public class SWInventory implements Listener {
|
||||
|
||||
e.setCancelled(true);
|
||||
if(callbacks.containsKey(e.getRawSlot()))
|
||||
callbacks.get(e.getSlot()).clicked(e.getClick());
|
||||
callbacks.get(e.getRawSlot()).clicked(e.getClick());
|
||||
}
|
||||
|
||||
@EventHandler
|
@ -38,6 +38,15 @@ public class SWItem {
|
||||
}
|
||||
}
|
||||
|
||||
public static Material getDye(int colorCode){
|
||||
switch(Core.getVersion()){
|
||||
case 14:
|
||||
return SWItem_v14.getDye(colorCode);
|
||||
default:
|
||||
return SWItem_v12.getDye();
|
||||
}
|
||||
}
|
||||
|
||||
public SWItem(){
|
||||
itemStack = new ItemStack(Material.AIR);
|
||||
itemMeta = itemStack.getItemMeta();
|
||||
@ -53,7 +62,11 @@ public class SWItem {
|
||||
}
|
||||
|
||||
public SWItem(Material material, byte meta, String name, List<String> lore, boolean enchanted, InvCallback c){
|
||||
try{
|
||||
itemStack = new ItemStack(material, 1, (short)0, meta);
|
||||
}catch(IllegalArgumentException e){
|
||||
itemStack = new ItemStack(material, 1);
|
||||
}
|
||||
itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta != null){
|
@ -31,19 +31,19 @@ public class SWListInv<T> extends SWInventory {
|
||||
setCallback(-999, (ClickType click) -> player.closeInventory());
|
||||
if(elements.size() > 54){
|
||||
if(page != 0)
|
||||
setItem(45, SWItem.getMaterial("INK_SACK"), (byte)10, "§eSeite zurück", (ClickType click) -> {
|
||||
setItem(45, SWItem.getDye(10), (byte)10, "§eSeite zurück", (ClickType click) -> {
|
||||
page--;
|
||||
open();
|
||||
});
|
||||
else
|
||||
setItem(45, SWItem.getMaterial("INK_SACK"), (byte)8, "§7Seite zurück", (ClickType click) -> {});
|
||||
setItem(45, SWItem.getDye(8), (byte)8, "§7Seite zurück", (ClickType click) -> {});
|
||||
if(page < elements.size()/45)
|
||||
setItem(53, SWItem.getMaterial("INK_SACK"), (byte)10, "§eSeite vor", (ClickType click) -> {
|
||||
setItem(53, SWItem.getDye(10), (byte)10, "§eSeite vor", (ClickType click) -> {
|
||||
page++;
|
||||
open();
|
||||
});
|
||||
else
|
||||
setItem(53, SWItem.getMaterial("INK_SACK"), (byte)8, "§7Seite vor", (ClickType click) -> {});
|
||||
setItem(53, SWItem.getDye(8), (byte)8, "§7Seite vor", (ClickType click) -> {});
|
||||
}
|
||||
|
||||
int ipageLimit = elements.size() - page*45;
|
@ -40,15 +40,9 @@ public class EventFight {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*public void setErgebnis(FightTeam winner){
|
||||
if (winner == null)
|
||||
ergebnis = 0;
|
||||
else if (winner.isBlue())
|
||||
ergebnis = 1;
|
||||
else
|
||||
ergebnis = 2;
|
||||
SQL.update("UPDATE EventFight SET Ergebnis = " + ergebnis + " WHERE FightID = " + fightID);
|
||||
}*/
|
||||
public void setErgebnis(int winner){
|
||||
SQL.update("UPDATE EventFight SET Ergebnis = " + winner + " WHERE FightID = " + fightID);
|
||||
}
|
||||
|
||||
public int getTeamBlue() {
|
||||
return teamBlue;
|
7
SpigotCore_Main/src/plugin.yml
Normale Datei
7
SpigotCore_Main/src/plugin.yml
Normale Datei
@ -0,0 +1,7 @@
|
||||
name: SpigotCore
|
||||
version: 1.0
|
||||
author: Lixfel
|
||||
api-version: 1.13
|
||||
|
||||
main: de.steamwar.core.Core
|
||||
commands:
|
37
pom.xml
37
pom.xml
@ -4,10 +4,10 @@
|
||||
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>
|
||||
|
||||
<groupId>de.steamwar</groupId>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>SpigotCore</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<version>2.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
@ -22,16 +22,6 @@
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src</directory>
|
||||
<excludes>
|
||||
<exclude>**/*.java</exclude>
|
||||
<exclude>**/*.kt</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -45,20 +35,9 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot-1.12</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot-1.14</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<modules>
|
||||
<module>SpigotCore_12</module>
|
||||
<module>SpigotCore_14</module>
|
||||
<module>SpigotCore_Main</module>
|
||||
</modules>
|
||||
</project>
|
@ -1,11 +0,0 @@
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class SWInventory_v12 extends CraftInventoryCustom {
|
||||
|
||||
SWInventory_v12(Player player, int size, String title) {
|
||||
super(player, size, title);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftInventoryCustom;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
class SWInventory_v14 extends CraftInventoryCustom {
|
||||
|
||||
SWInventory_v14(Player player, int size, String title) {
|
||||
super(player, size, title);
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
class SWItem_v14 {
|
||||
private SWItem_v14(){}
|
||||
|
||||
static Material getMaterial(String material){
|
||||
return Material.valueOf("LEGACY_" + material);
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
name: CoreSystem
|
||||
version: 1.0
|
||||
|
||||
author: hunjy, Lixfel
|
||||
|
||||
main: de.steamwar.core.Core
|
||||
|
||||
commands:
|
In neuem Issue referenzieren
Einen Benutzer sperren