From 38a4ca72a46f173e9aaffc42cfef91430e94bbf7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 16 Dec 2019 20:07:57 +0100 Subject: [PATCH 1/5] Schemdownloadlink (untested) --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 4 ++++ .../schematicsystem/commands/SchematicCommand.java | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index c605b95..9d6ba9e 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -126,6 +126,10 @@ class GUI { p.closeInventory(); changeType(p, schem); }); + inv.setItem(5, SWItem.getMaterial(""), "§eDownload", click -> { + p.closeInventory(); + SchematicCommand.download(p, schem); + }); inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> { p.closeInventory(); delmembers(p, schem); diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index af2ed7c..7e00414 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -308,6 +308,15 @@ public class SchematicCommand implements CommandExecutor { } } + static void download(Player player, Schematic schematic){ + if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()){ + player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!"); + return; + } + + player.sendMessage(DownloadSchematic.getLink(schematic)); + } + private void addmember(Player player, String[] args){ if(args.length < 3){ help(player); -- 2.39.2 From 91b4fa1d53dbbf2bea32b9f197e216beaff99b00 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 16 Dec 2019 20:15:14 +0100 Subject: [PATCH 2/5] Schemdownloadlink (untested) --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 9d6ba9e..3b8f8f0 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -121,19 +121,23 @@ class GUI { p.closeInventory(); changeItem(p, schem); }); + if(schem.availible()) inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { p.closeInventory(); changeType(p, schem); }); + inv.setItem(5, SWItem.getMaterial(""), "§eDownload", click -> { p.closeInventory(); SchematicCommand.download(p, schem); }); + inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> { p.closeInventory(); delmembers(p, schem); }); + inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { p.closeInventory(); delete(p, schem); -- 2.39.2 From d64ee738114e6b9d8bbd10725803f13f79a8e1f3 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Mon, 16 Dec 2019 20:21:22 +0100 Subject: [PATCH 3/5] Schemdownloadlink (untested) --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 3b8f8f0..9d6ba9e 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -121,23 +121,19 @@ class GUI { p.closeInventory(); changeItem(p, schem); }); - if(schem.availible()) inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { p.closeInventory(); changeType(p, schem); }); - inv.setItem(5, SWItem.getMaterial(""), "§eDownload", click -> { p.closeInventory(); SchematicCommand.download(p, schem); }); - inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> { p.closeInventory(); delmembers(p, schem); }); - inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { p.closeInventory(); delete(p, schem); -- 2.39.2 From cc144f9be606b9450eaed733d1b9f51247e10f98 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 19 Dec 2019 07:18:11 +0100 Subject: [PATCH 4/5] Setting Item and adding option for chat based system --- .../schematicsystem/commands/GUI.java | 2 +- .../commands/SchematicCommand.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 9d6ba9e..fac69a7 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -126,7 +126,7 @@ class GUI { p.closeInventory(); changeType(p, schem); }); - inv.setItem(5, SWItem.getMaterial(""), "§eDownload", click -> { + inv.setItem(5, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> { p.closeInventory(); SchematicCommand.download(p, schem); }); diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index 7e00414..cf5bad3 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -64,6 +64,9 @@ public class SchematicCommand implements CommandExecutor { case "delmember": delmember(player, args); break; + case "download": + download(player, args); + break; default: help(player); } @@ -281,6 +284,13 @@ public class SchematicCommand implements CommandExecutor { } player.spigot().sendMessage(type); + if(SteamwarUser.get(schematic.getSchemOwner()).getUUID().equals(player.getUniqueId())){ + TextComponent download = new TextComponent("§eDownload Schematic"); + download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eGeneriere Downloadlink"))); + download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + schematic.getSchemName())); + player.spigot().sendMessage(type); + } + List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId()); for(int i = checkedSchematics.size() -1; i >= 0; i--) { if(checkedSchematics.get(i).getSchemName().equals(schematic.getSchemName()) && @@ -308,6 +318,19 @@ public class SchematicCommand implements CommandExecutor { } } + private void download(Player player, String[] args){ + if(args.length < 2){ + help(player); + return; + } + + Schematic schematic = getSchem(player, args[1]); + if(schematic == null) + return; + + download(player, schematic); + } + static void download(Player player, Schematic schematic){ if(schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()){ player.sendMessage("§cDu darfst nur deine eigenen Schematics herunterladen!"); @@ -409,6 +432,7 @@ public class SchematicCommand implements CommandExecutor { player.sendMessage("§8/§eschem changetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic"); player.sendMessage("§8/§eschem delete §8[§7Schematic§8] - §7Löscht eine Schematic"); player.sendMessage("§8/§eschem info §8[§7Schematic§8] - §7Zeigt dir Informationen zur Schematic"); + player.sendMessage("§8/§eschem download §8[§7Schematic§8] - §7Gibt dir einen Downloadlink (1 min gültig)"); player.sendMessage("§8/§eschem addmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Fügt einen Spieler zu einer Schematic hinzu"); player.sendMessage("§8/§eschem delmember §8[§7Schematic§8] §8[§7Spieler§8] - §7Entfernt einen Spieler von einer Schematic"); } -- 2.39.2 From cd1e9f1bb5890ce7c979913499464cc1262eef88 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 19 Dec 2019 07:19:50 +0100 Subject: [PATCH 5/5] Setting Item and adding option for chat based system --- .../de/steamwar/schematicsystem/commands/SchematicCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index cf5bad3..8014119 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -288,7 +288,7 @@ public class SchematicCommand implements CommandExecutor { TextComponent download = new TextComponent("§eDownload Schematic"); download.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText("§eGeneriere Downloadlink"))); download.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/schem download " + schematic.getSchemName())); - player.spigot().sendMessage(type); + player.spigot().sendMessage(download); } List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId()); -- 2.39.2