-Drop:
+create:
- type: command
- speed: 0
- debug: false
- name: Drop
- description: Setze Drops
- usage: /drops
- aliases:
- - drops
- allowed help:
- - determine true
-
- commandArgs:
- setzen:
- usage: '/drop setzen'
- erzeugen:
- usage: '/drop erzeugen'
- loeschen:
- usage: '/drop loeschen'
- anzeige:
- usage: '/drop anzeige'
- hinzu:
- usage: 'drop hinzu'
-
- script:
- - define command '<c.args.get[1].escaped||help]>'
- - define args '<script.list_keys[commandargs].alphanumeric.to_lowercase||li@>'
- - if !<def[args].contains[%command%]> {
- - inject local help
- }
- else {
- - inject local %command% }
-
- setzen:
- - if <player.is_op> {
- - if <c.args.get[2]||null> == null {
- - narrate "<yellow>[DropWorld] <gray>Du musst diesen Ort einen Namen geben!"
- - queue clear }
- - if <yaml[spawning].list_keys[Drop]||null> contains <c.args.get[2]> {
- - narrate "<yellow>[DropWorld] <gray>Der Name exestiert schon!"
- - queue clear }
- - if <c.args.get[2].length> >= 9 {
- - narrate "<yellow>[DropWorld] <gray>Der Name darf nur maximal 8 Buchstaben lang sein!!"
- - queue clear }
- - if <c.args.get[3]||null> == null {
- - narrate "<yellow>[DropWorld] <gray>Bitte gib eine Wahrscheinlichkeit noch an!"
- - queue clear }
- - if <c.args.get[3].as_int||null> == null {
- - narrate "<yellow>[DropWorld] <gray>Es sollte schon eine Zahl sein!"
- - queue clear }
- - if <c.args.get[3]> <= 0 || <c.args.get[3]> > 1000 {
- - narrate "<yellow>[DropWorld] <gray>Es stehen dir Zahlen zwischen 1 und 1000 zur Verf<ü>gung!"
- - queue clear }
- - define name <c.args.get[2]>
- - define location <player.location.simple>
- - define wahrscheinlichkeit <c.args.get[3]>
- - define sichtwinkel <player.location.cursor_on.add[0.5,0,0.5]>
- - narrate %sichtwinkel%
- - foreach <player.location.find.blocks[chest].within[10]> {
- - if %value% == %sichtwinkel% {
- - define slotzahl 1
- - while true {
- - define itemm <%value%.inventory.slot[<def[slotzahl].as_int>].simple>
- - if <%value%.inventory.slot[1].simple> == i@air {
- - narrate "<yellow>[DropWorld] <red> Es muss aufjedenfall in Slot 1 ein Item sein! Dies wird immer gedropt egal welche wahrscheinlichkeit, dient dazu immer ein item spawnen zu lassen!"
- - queue clear }
- - if %itemm% !== i@air {
- - define itemanzahl <%value%.inventory.qty[%itemm%].as_int>
- - if <yaml[spawning].list_keys[Drop.%name%.item]> !contains %itemm% {
- - yaml id:spawning set Drop.%name%.item.%itemm%.itemanzahl:->:%itemanzahl%
- - yaml id:spawning set Drop.%name%.item.%itemm%.wahrscheinlichkeit:->:%wahrscheinlichkeit% } }
- - define slotzahl <math:%slotzahl%+1>
- - if <def[slotzahl]> == 28 {
- - narrate "<yellow>[DropWorld] <gray>Gespeichert als <yellow>N:<gray>[%name%] <yellow>O:<gray>[%location%] <yellow>I:<gray>[S. Kiste] <yellow>A:<gray>[S. Kiste] <yellow>W:<gray>[%wahrscheinlichkeit%]"
- - yaml id:spawning set Drop.%name%.Ort:->:%location%
- - yaml savefile:dropeinstellung/spawning.yml id:spawning
- - queue clear }
- }
- }
- }
- - narrate "<yellow>[DropWorld] <red>Cursor muss sich auf einer Truhe in deiner n<ä>he befinden!"
- - queue clear
- }
- - narrate "<yellow>[DropWorld] <red>Du hast auf diesen Befehl kein Zugriff!"
- - queue clear
-
- loeschen:
- - if <player.is_op> {
- - if <c.args.get[2]||null> == null {
- - narrate "<yellow>[DropWorld] <gray>Du musst diesen Ort einen Namen geben!"
- - queue clear }
- - if <yaml[spawning].list_keys[Drop]||null> !contains <c.args.get[2]> {
- - narrate "<yellow>[DropWorld] <gray>Der Name exestiert nicht in deiner Liste!"
- - queue clear }
- - define name <c.args.get[2]>
- - narrate "<yellow>[DropWorld] <gray>Deine Position %name% wurde gel<ö>scht!"
- - yaml id:spawning set Drop.%name%:!
- - yaml savefile:dropeinstellung/spawning.yml id:spawning
- - queue clear
- }
- - narrate "<yellow>[DropWorld] <red>Du hast auf diesen Befehl kein Zugriff!"
- - queue clear
-
- erzeugen:
- if <player.is_op> || <c.server> {
- - define eingabe <context.args.get[2]||null>
- - if %eingabe% == null {
- - narrate "<yellow>[DropWorld] <gray>Bitte gib einen Namen ein!"
+ - define args <context.args.get[2]||null>
+ - if %args% == null {
+ - narrate "<yellow>[DropWorld] <gray>Please enter a name!"
- queue clear
}
- - if <yaml[spawning].list_keys[Drop]||null> !contains %eingabe% {
- - narrate "<yellow>[DropWorld] <gray>Der Name exestiert nicht in der Liste!"
+ - if <yaml[spawning].list_keys[Drop]||null> !contains %args% {
+ - narrate "<yellow>[DropWorld] <gray>The name does not exist in that list!"
- queue clear
- }
- - define ort <yaml[spawning].read[drop.%eingabe%.ort].as_string>
- - foreach <yaml[spawning].list_keys[drop.%eingabe%.item].filter[is[equals].to[i@air].not]> {
+ }
+ - define location <yaml[spawning].read[drop.%args%.location].as_string>
+ - foreach <yaml[spawning].list_keys[drop.%args%.item].filter[is[equals].to[i@air].not]> {
- narrate %value%
- - flag server item_%eingabe%:->:%value%
+ - flag server item_%args%:->:%value%
}
- - define itemm <server.flag[item_%eingabe%].as_list.random.simple||null>
+ - define itemm <server.flag[item_%args%].as_list.random.simple||null>
- if %itemm% == null {
- queue clear
}
- - define itemanzahl <yaml[spawning].read[drop.%eingabe%.item.%itemm%.itemanzahl].as_String>
- - define wahrscheinlichkeit <yaml[spawning].read[drop.%eingabe%.item.<def[itemm].simple>.wahrscheinlichkeit].as_string>
+ - define itemcount <yaml[spawning].read[drop.%args%.item.%itemm%.itemcount].as_String>
+ - define probability <yaml[spawning].read[drop.%args%.item.<def[itemm].simple>.probability].as_string>
- if <util.random.int[1].to[1000]> <= %wahrscheinlichkeit% {
- - drop %itemm% location:%ort% qty:%itemanzahl%
- - flag server item_%eingabe%:!
- - narrate "wurde gespawnt: %itemm% mit %wahrscheinlichkeit%"
+ - drop %itemm% location:%location% qty:%itemcount%
+ - flag server item_%args%:!
+ - narrate "wurde gespawnt: %itemm% mit %probability%"
- queue clear
} else {
- - drop %itemm% location:%ort% qty:%itemanzahl%
- - flag server item_%eingabe%:!
+ - drop %itemm% location:%location% qty:%itemcount%
+ - flag server item_%args%:!
- queue clear
}
}
- - narrate "<yellow>[DropWorld] <red>Du hast auf diesen Befehl kein Zugriff!"
+ - narrate "<yellow>[DropWorld] <red>You are not allowed to use this command!"
- - queue clear
-
- anzeige:
- - if <player.is_op> {
- - define count 1
- - narrate "<gray>_______________<yellow>[Drop World]<gray>_______________"
- - narrate ""
- - foreach <yaml[spawning].list_keys[Drop]||null> {
- - narrate "<red>[<def[count].as_int>] <yellow>N: <gray>%value% <yellow>O: <gray><yaml[spawning].read[Drop.%value%.ort].as_string||null> <yellow>I: <gray><yaml[spawning].read[Drop.%value%.item].as_string||null> <yellow>A: <gray><yaml[spawning].read[Drop.%value%.itemanzahl].as_string||null> <yellow>W: <gray><yaml[spawning].read[Drop.%value%.wahrscheinlichkeit].as_string||null>"
- - define count <math:%count%+1> }
- queue clear
- }
- - narrate "<yellow>[DropWorld] <red>Du hast auf diesen Befehl kein Zugriff!"
- - queue clear
-
- help:
- - if <player.is_op> {
- - narrate "<gray>_______________<yellow>[Drop World]<gray>_______________"
- - narrate ""
- - narrate "<yellow>/drop setzen NAME ITEMANZAHL WAHRSCHEINLICHKEIT <gray>[Drop-Punkt unter Spieler]"
- - narrate "<yellow>/drop loeschen NAME <gray>[L<ö>scht den Drop-Punkt]"
- - narrate "<yellow>/drop erzeugen NAME <gray>[Spawnt Item am Drop-Punkt]"
- - narrate "<yellow>/drop anzeige <gray>[Zeigt alle Drop-Orte an]"
- }