SteamWar/SpigotCore
Archiviert
13
0

Massive Refactoring + adding 1.14 support

Dieser Commit ist enthalten in:
Lixfel 2019-11-10 17:28:09 +01:00
Ursprung 3e31762fe6
Commit 6244c79b63
32 geänderte Dateien mit 260 neuen und 90 gelöschten Zeilen

37
SpigotCore_12/pom.xml Normale Datei
Datei anzeigen

@ -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>

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -8,4 +8,8 @@ class SWItem_v12 {
static Material getMaterial(String material){ static Material getMaterial(String material){
return Material.valueOf(material); return Material.valueOf(material);
} }
static Material getDye(){
return Material.INK_SACK;
}
} }

37
SpigotCore_14/pom.xml Normale Datei
Datei anzeigen

@ -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>

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -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
Datei anzeigen

@ -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>

Datei anzeigen

@ -1,6 +1,5 @@
package de.steamwar.core.events; package de.steamwar.core.events;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
@ -9,7 +8,6 @@ public class ChattingEvent implements Listener {
@EventHandler @EventHandler
private void onChat(AsyncPlayerChatEvent event) { private void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer(); event.setFormat("§eLokal §r"+ event.getPlayer().getDisplayName() + "§8» §7" + event.getMessage());
event.setFormat("§eLokal §r"+ player.getDisplayName() + "§8» §7" + event.getMessage());
} }
} }

Datei anzeigen

@ -26,10 +26,10 @@ public class SWInventory implements Listener {
player = p; player = p;
switch(Core.getVersion()){ switch(Core.getVersion()){
case 14: case 14:
inventory = new SWInventory_v14(p, size, t); inventory = SWInventory_v14.get(p, size, t);
break; break;
default: 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); e.setCancelled(true);
if(callbacks.containsKey(e.getRawSlot())) if(callbacks.containsKey(e.getRawSlot()))
callbacks.get(e.getSlot()).clicked(e.getClick()); callbacks.get(e.getRawSlot()).clicked(e.getClick());
} }
@EventHandler @EventHandler

Datei anzeigen

@ -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(){ public SWItem(){
itemStack = new ItemStack(Material.AIR); itemStack = new ItemStack(Material.AIR);
itemMeta = itemStack.getItemMeta(); 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){ public SWItem(Material material, byte meta, String name, List<String> lore, boolean enchanted, InvCallback c){
itemStack = new ItemStack(material, 1, (short)0, meta); try{
itemStack = new ItemStack(material, 1, (short)0, meta);
}catch(IllegalArgumentException e){
itemStack = new ItemStack(material, 1);
}
itemMeta = itemStack.getItemMeta(); itemMeta = itemStack.getItemMeta();
if(itemMeta != null){ if(itemMeta != null){

Datei anzeigen

@ -31,19 +31,19 @@ public class SWListInv<T> extends SWInventory {
setCallback(-999, (ClickType click) -> player.closeInventory()); setCallback(-999, (ClickType click) -> player.closeInventory());
if(elements.size() > 54){ if(elements.size() > 54){
if(page != 0) 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--; page--;
open(); open();
}); });
else 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) 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++; page++;
open(); open();
}); });
else 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; int ipageLimit = elements.size() - page*45;

Datei anzeigen

@ -40,15 +40,9 @@ public class EventFight {
return null; return null;
} }
/*public void setErgebnis(FightTeam winner){ public void setErgebnis(int winner){
if (winner == null) SQL.update("UPDATE EventFight SET Ergebnis = " + winner + " WHERE FightID = " + fightID);
ergebnis = 0; }
else if (winner.isBlue())
ergebnis = 1;
else
ergebnis = 2;
SQL.update("UPDATE EventFight SET Ergebnis = " + ergebnis + " WHERE FightID = " + fightID);
}*/
public int getTeamBlue() { public int getTeamBlue() {
return teamBlue; return teamBlue;

Datei anzeigen

@ -0,0 +1,7 @@
name: SpigotCore
version: 1.0
author: Lixfel
api-version: 1.13
main: de.steamwar.core.Core
commands:

37
pom.xml
Datei anzeigen

@ -4,10 +4,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 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> <modelVersion>4.0.0</modelVersion>
<groupId>de.steamwar</groupId> <groupId>steamwar</groupId>
<artifactId>SpigotCore</artifactId> <artifactId>SpigotCore</artifactId>
<version>1.0</version> <version>2.0</version>
<packaging>jar</packaging> <packaging>pom</packaging>
<url>https://maven.apache.org</url> <url>https://maven.apache.org</url>
<properties> <properties>
@ -22,16 +22,6 @@
</repositories> </repositories>
<build> <build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.kt</exclude>
</excludes>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -45,20 +35,9 @@
</plugins> </plugins>
</build> </build>
<dependencies> <modules>
<dependency> <module>SpigotCore_12</module>
<groupId>steamwar</groupId> <module>SpigotCore_14</module>
<artifactId>Spigot-1.12</artifactId> <module>SpigotCore_Main</module>
<version>1.0</version> </modules>
<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>
</project> </project>

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -1,8 +0,0 @@
name: CoreSystem
version: 1.0
author: hunjy, Lixfel
main: de.steamwar.core.Core
commands: