Merge branch '1.13' of https://github.com/Sataniel98/Brewery into Sataniel98-1.13

This commit is contained in:
Sn0wStorm 2018-10-26 21:17:09 +02:00
commit 4f85574e48
21 changed files with 3709 additions and 2047 deletions

96
pom.xml
View File

@ -4,7 +4,7 @@
<groupId>com.dre</groupId>
<artifactId>brewery</artifactId>
<version>1.6.1</version>
<version>1.7</version>
<name>Brewery</name>
<properties>
@ -33,20 +33,46 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.bstats:bstats-bukkit</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.bstats.bukkit</pattern>
<shadedPattern>com.dre.brewery.integration</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>md_5-releases</id>
<url>http://repo.md-5.net/content/repositories/releases/</url>
<id>md_5-public</id>
<url>http://repo.md-5.net/content/groups/public/</url>
</repository>
<repository>
<id>spigot-repo</id>
@ -56,29 +82,33 @@
<id>vault-repo</id>
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository>
<repository>
<id>mcstats-repo</id>
<url>http://repo.mcstats.org/content/repositories/public/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>dre2n-rpo</id>
<url>http://feuerstern.bplaced.net/repo/</url>
<url>http://erethon.de/repo/</url>
</repository>
<repository>
<id>devoted-repo</id>
<url>https://build.devotedmc.com/plugin/repository/everything/</url>
</repository>
<repository>
<id>bstats-repo</id>
<url>http://repo.bstats.org/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12-R0.1-SNAPSHOT</version>
<version>1.13.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -91,13 +121,13 @@
<groupId>vg.civcraft.mc.citadel</groupId>
<artifactId>Citadel</artifactId>
<version>3.9.1</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>vg.civcraft.mc.civmodcore</groupId>
<artifactId>CivModCore</artifactId>
<version>1.6.0</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q</groupId>
@ -106,28 +136,46 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.griefcraft.lwc</groupId>
<artifactId>LWCPlugin</artifactId>
<version>4.5.0-SNAPSHOT</version>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.ryanhamshire</groupId>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-legacy</artifactId>
<version>7.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.griefcraft</groupId>
<artifactId>entitylwc</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TechFortress</groupId>
<artifactId>GriefPrevention</artifactId>
<version>14.5.4</version>
<version>16.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.diddiz</groupId>
<artifactId>logblock</artifactId>
<version>1.94</version>
<version>1.13.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>de.diddiz</groupId>
<artifactId>questioner</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>de.diddiz</groupId>
<artifactId>questioner</artifactId>
<version>1.94</version>
<scope>provided</scope>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -65,7 +65,7 @@ updateCheck: true
autosave: 3
# Config Version
version: '1.5'
version: '1.6'
# -- Rezepte für Getränke --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Config Version
version: '1.5'
version: '1.6'
# -- Recipes for Potions --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Version de configuration
version: '1.5'
version: '1.6'
# -- Recette pour les boissons --

View File

@ -62,7 +62,7 @@ updateCheck: true
autosave: 3
# Versione del config
version: '1.5'
version: '1.6'
# -- Ricette per pozioni --

View File

@ -0,0 +1,537 @@
# config für Brewery.jar
# -- Verschiedene Einstellungen --
# Standardeinstellungen sind in [] angegeben
# Löschen einzelner Einstellungen deaktiviert sie
# Sprachedatei die genutzt werden sollte (befindet sich in plugins/Brewery/languages)
language: de
# Ob der Spieler beim nächsten Einloggen nach starker Trunkenheit am nächsten morgen Zuhause "aufwacht" (Ein home Plugin muss installiert sein!) [true]
enableHome: true
# Art des Nachhause-teleports: ['cmd: home']
# bed = Spieler wird zu seinem Spawn Bett teleportiert
# 'cmd: home' = /home wird vom Spieler ausgelöst. Es sollte kein Verzögerungs, etc. plugin installiert sein!
# 'cmd: spawn' = /spawn wird vom Spieler ausgelöst
# 'cmd: whatever' = /whatever wird vom Spieler ausgelöst
homeType: 'cmd: home'
# Ob der Spieler nach etwas kürzerem Ausloggen an einem zufälligen Ort "aufwacht" (diese müssen durch '/brew Wakeup add' von einem Admin festgelegt werden)
# Der Spieler wacht an dem nähesten zweier zufälliger Orte aus seiner Welt auf. [true]
enableWake: true
# Ob der Spieler bei großer Trunkenheit mehrmals probieren muss sich einzuloggen, da sein Charakter kurz nicht reagiert [true]
enableLoginDisallow: true
# Ob der Spieler kurz in Ohnmacht fällt (vom Server gekickt wird) wenn er die maximale Trunkenheit erreicht [false]
enableKickOnOverdrink: false
# Ob der Spieler sich bei großer Trunkenheit übergibt (unten definiertes Item aus dem Mund fallen lässt) [true]
# Das Item kann nicht aufgesammelt werden und bleibt bis zum Despawnen liegen.
enablePuke: true
# Item das beim Erbrechen mehrfach unaufsammelbar fallen gelassen wird [SOUL_SAND]
pukeItem: SOUL_SAND
# Zeit in Sekunden bis die pukeitems despawnen, (mc standard wäre 300 = 5 min) [60]
# Wurde die item Despawnzeit in der spigot.yml verändert, verändert sich auch die pukeDespawnzeit in Abhängigkeit.
pukeDespawntime: 60
# Konsumierbares Item/Stärke. Senkt den Alkoholpegel um <Stärke> wenn konsumiert.
drainItems:
- BREAD/4
- MILK_BUCKET/2
# Zeit (in Tagen) die Trunkenheitsdaten nach offlinegehen eines Spielers im Speicher verbleiben, um z.B. Kater-Effekte anzuwenden. [7]
hangoverDays: 7
# Färben der Iteminformationen je nach Qualität während sie sich 1. im Fass und/oder 2. im Braustand befinden [true, true]
colorInBarrels: true
colorInBrewer: true
# Ob große Fässer an jedem Block geöffnet werden können, nicht nur an Zapfhahn und Schild. Bei kleinen Fässern geht dies immer. [true]
openLargeBarrelEverywhere: true
# In den Serverlog loggen was der Spieler tatsächlich geschrieben hat, bevor seine Worte verändert wurden [false]
logRealChat: false
# Aktiviert das Suchen nach Updates für Brewery mit der curseforge api [true]
# Wenn ein Update gefunden wurde, wird dies bei Serverstart im log angezeigt, sowie OPs benachrichtigt
updateCheck: true
# Autosave Intervall in Minuten [3]
autosave: 3
# Config Version
version: '1.6'
# -- Rezepte für Getränke --
# name: Verschiedene Namen für schlecht/mittel/gut (Farbcodes möglich: z.b. &6)
# ingredients: Auflistung von 'Material oder ID,Data/Anzahl'
# (Item-ids anstatt Material werden von Bukkit nicht mehr unterstützt und funktionieren möglicherweise in Zukunft nicht mehr!)
# Eine Liste von allen Materialien kann hier gefunden werden: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
# Es kann ein Data-Wert (durability) angegeben werden, weglassen ignoriert diesen beim hinzufügen einer Zutat
# Wenn Vault installiert ist können normale englische Item Namen verwendet werden, anstatt Material, ID und Data!
# Vault erkennt Namen wie "Jungle Leaves" anstatt "LEAVES,3". Dies macht es viel einfacher!
# cookingtime: Zeit in Echtminuten die die Zutaten kochen müssen
# distillruns: Wie oft destilliert werden muss für vollen Alkoholgehalt (0=ohne Destillieren)
# distilltime: Wie lange (in sekunden) ein Destillations-Durchlauf braucht (0=Standard Zeit von 40 sek) MC Standard wäre 20 sek
# wood: Holz des Fasses 0=alle Holzsorten 1=Birke 2=Eiche 3=Jungel 4=Fichte 5=Akazie 6=Schwarzeiche
# age: Zeit in Minecraft-Tagen, die das Getränk im Fass reifen muss 0= kein reifen
# color: Farbe des Getränks nach destillieren/reifen.
# Benutzbare Farben: DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY
# difficulty: 1-10 Genauigkeit der Einhaltung der Vorgaben (1 = ungenau/einfach 10 = sehr genau/schwer)
# alcohol: Alkoholgehalt 0-100 in absoluter Menge bei perfektem Getränk (wird dem Spieler hinzugefügt, bei 100 = tot)
# effects: Auflistung Effekt/Level/Dauer Besonderere Trank-Effekte beim Trinken, Dauer in sek.
# Ein 'X' an den Namen anhängen, um ihn zu verbergen. Bsp: 'POISONX/2/10' (WEAKNESS, INCREASE_DAMAGE, SLOW und SPEED sind immer verborgen.)
# Effekte sind ab der 1.9 immer verborgen, wegen Änderungen an den Tränken.
# Mögliche Effekte: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
# Minimale und Maximale Level/Dauer können durch "-" festgelegt werden, Bsp: 'SPEED/1-2/30-40' = Level 1 und 30 sek minimal, Level 2 und 40 sek maximal
# Diese Bereiche funktionieren auch umgekehrt, Bsp: 'POISON/3-1/20-5' für abschwächende Effekte bei guter Qualität
# Längste mögliche Effektdauer: 1638 sek. Es muss keine Dauer für Effekte mit sofortiger Wirkung angegeben werden.
recipes:
# Ein vollständiges Beispiel zuerst:
0:
name: Schlechtes Beispiel/Beispiel/Gutes Beispiel
ingredients:
- SUGAR_CANE/5
- diamond/1
- Cocoa_Beans/20
- spruce_planks/8
- BEDROCK/1
# - Jungle Leaves/64 # Nur mit Vault
# - Green Dye/6 # Nur mit Vault
cookingtime: 3
distillruns: 2
distilltime: 60
wood: 4
age: 11
color: DARK_RED
difficulty: 3
alcohol: 23
effects:
- FIRE_RESISTANCE/20
- HEAL/1
- WEAKNESS/2-3/50-60
- POISONX/1-0/20-0
1:
name: Ranziges Weißbier/Weißbier/Feines Weißbier
ingredients:
- WHEAT/3
cookingtime: 8
distillruns: 0
wood: 1
age: 2
color: BRIGHT_GREY
difficulty: 1
alcohol: 5
2:
name: Ranziges Bier/Bier/Feines Bier
ingredients:
- WHEAT/6
cookingtime: 8
distillruns: 0
wood: 0
age: 3
color: ORANGE
difficulty: 1
alcohol: 6
3:
name: Ranziges Dunkelbier/Dunkelbier/Feines Dunkelbier
ingredients:
- WHEAT/6
cookingtime: 8
distillruns: 0
wood: 4
age: 8
color: BLACK
difficulty: 2
alcohol: 7
4:
name: Scheußlicher Met/Met/&6Goldener Met
ingredients:
- SUGAR_CANE/6
cookingtime: 3
distillruns: 0
wood: 2
age: 4
color: ORANGE
difficulty: 2
alcohol: 9
5:
name: Apfelmet/Süßer Apfelmet/&6Goldensüßer Apfelmet
ingredients:
- SUGAR_CANE/6
- APPLE/2
cookingtime: 4
distillruns: 0
wood: 2
age: 4
color: ORANGE
difficulty: 4
alcohol: 12
effects:
- WATER_BREATHINGX/1-2/150
6:
name: Bitterer Rum/Würziger Rum/&6Goldener Rum
ingredients:
- SUGAR_CANE/14
cookingtime: 5
distillruns: 2
distilltime: 30
wood: 2
age: 14
color: DARK_RED
difficulty: 6
alcohol: 30
effects:
- FIRE_RESISTANCE/1/20-100
- POISONX/1-0/30-0
7:
name: Abgeranzter Vodka/Vodka/Russischer Vodka
ingredients:
- POTATO/10
cookingtime: 15
distillruns: 3
age: 0
color: BRIGHT_GREY
difficulty: 4
alcohol: 20
effects:
- WEAKNESS/15
- POISON/10
8:
name: minderwertiger Absinth/Absinth/Starker Absinth
ingredients:
- GRASS/15
cookingtime: 3
distillruns: 6
distilltime: 80
color: GREEN
difficulty: 8
alcohol: 45
effects:
- POISON/20-30
9:
name: Kartoffelsuppe
ingredients:
- POTATO_ITEM/5
- LONG_GRASS/3
cookingtime: 3
color: PINK
difficulty: 1
effects:
- HEAL/0-1
10:
name: Fader Kaffee/Kaffee/Starker Kaffee
ingredients:
- INK_SACK,3/12
- MILK_BUCKET/2
cookingtime: 2
color: BLACK
difficulty: 3
effects:
- REGENERATION/1/2-5
- SPEED/1/30-140
# Mehr Ideen für Rezepte: Cachaca, Gin, Whiskey, Tequila, Cidre, etc, sowie Rezeptvarianten wie Goldener Vodka etc.
# Ich werde keine weiteren Rezepte zu dieser Standardconfig hinzufügen, da diese öffentlich und für Spieler zum Abschauen einsehbar wären
# Der Serveradmin kann neue Rezepte hinzufügen und bestehende ändern, um das Abschauen aus der Standardconfig zu verhindern.
# cooked: ALLE möglichen Zutaten und die nach dem Gähren daraus entstehenden Tranknamen:
# [Beispiel] MATERIAL_oder_id: Name nach Gähren
cooked:
WHEAT: Getreideferment
SUGAR_CANE: Zuckersud
APPLE: Apfelmost
POTATO: Kartoffelmaische
GRASS: Kräuterbrühe
RED_MUSHROOM: Pilzsud
Cocoa_Beans: Farbige Brühe
MILK_BUCKET: Milchiges Wasser
# -- Plugin Kompatiblität --
# Andere Plugins (wenn installiert) nach Rechten zum öffnen von Fässern checken [true]
useWorldGuard: true
useLWC: true
useGriefPrevention: true
# Änderungen an Fassinventaren mit LogBlock aufzeichen [true]
useLogBlock: true
# -- Chat Veränderungs Einstellungen --
# Ob geschriebener Chat bei großer Trunkenheit abgefälscht werden soll,
# so dass es etwas betrunken aussieht was geschrieben wird.
# Wie stark der Chat verändert wird hängt davon ab wie betrunken der Spieler ist
# Unten kann noch eingestellt werden wie und was verändert wird
enableChatDistortion: true
# Text nach den angegebenen Kommandos wird bei Trunkenheit ebenfalls Verändert (Liste) [- /gl]
distortCommands:
- /gl
- /global
- /fl
- /s
- /letter
- /g
- /l
- /lokal
- /local
- /mail send
- /m
- /msg
- /w
- /whisper
- /reply
- /r
- /t
- /tell
# Geschriebenen Text auf Schildern bei Trunkenheit verändern [false]
distortSignText: false
# Im Chat geschriebener Text, der zwischen diesen Buchstaben steht, wird nicht verändert ("," als Trennung verwenden) (Liste) [- '[,]']
# Also zum Beispiel im Chat: Hallo ich bin betrunken *Ich teste Brewery*
distortBypass:
- '*,*'
- '[,]'
# words: Wörter und Buchstaben die bei Chatten während Trunkenheit ersetzt werden sollen.
# Diese werden von oben nach unten gelesen und in dieser Reihenfolge wird ein geschriebener Satz dann verändert.
# replace: Zu ersetzendes Wort oder Buchstabe. (Besondere: "-space": ersetzt Leerzeichen, "-random": Einfügen in zufällige Position, "-all": Alles, "-start": Ganz am Anfang, "-end": Ganz ans Ende.)
# to: In welches Wort es ersetzt werden soll.
# pre: Wörter und Buchstaben vor dem gesuchten Wort (durch "," getrennt)
# match: true = eines der "pre"-Wörter muss vor dem gesuchten Wort stehen, false = keines der "pre" Wörter darf vor dem gesuchten stehen
# alcohol: 1-100 Trunkenheit ab der die Wörter ersetzt werden
# percentage: Wahrscheinlichkeit des Ersetzen eines Wortes in Prozent
words:
- replace: ch
to: sch
pre: u,s,o,a
match: false
alcohol: 10
percentage: 70
- replace: h
to: hh
pre: sch,h,t
match: false
percentage: 60
alcohol: 20
- replace: u
to: uuh
percentage: 20
- replace: u
to: uo
pre: u
match: false
percentage: 60
- replace: das
to: dass
percentage: 20
alcohol: 40
- replace: p
to: b
percentage: 30
- replace: p
to: b
percentage: 70
alcohol: 60
- replace: up
to: ubb
percentage: 80
- replace: o
to: oh
percentage: 20
- replace: ei
to: i
percentage: 15
- replace: b
to: bb
percentage: 80
alcohol: 40
- replace: '!!!'
to: '!!!111!!!einself!1!'
pre: '!'
match: false
percentage: 20
alcohol: 70
- replace: '!'
to: '!!'
pre: '!'
match: false
percentage: 90
- replace: betrunken
to: brhetriunkhn
pre: bist,seid
match: false
percentage: 70
alcohol: 65
- replace: laufen
to: lnhfeeehn
pre: kannst,kannst noch,kannst nicht
match: false
percentage: 80
alcohol: 30
- replace: gehen
to: hgheehn
pre: kannst,kannst noch,kannst nicht
match: false
percentage: 80
alcohol: 40
- replace: wtf
to: wft
percentage: 20
alcohol: 40
- replace: lol
to: loool
percentage: 80
alcohol: 10
- replace: afk
to: aafka
percentage: 20
alcohol: 30
- replace: schreiben
to: schribeen
pre: kannst,kannst noch,kannst nicht
match: false
percentage: 80
alcohol: 50
- replace: trinken
to: saufen
percentage: 80
alcohol: 70
- replace: '?'
to: '????'
pre: '?'
match: false
percentage: 80
alcohol: 40
- replace: -space
to: ''
pre: h,g,w
match: true
alcohol: 10
- replace: -space
to: ''
percentage: 30
alcohol: 35
- replace: -space
to: ''
percentage: 10
- replace: -start
to: dho
percentage: 15
alcohol: 50
- replace: -start
to: hhn
percentage: 10
alcohol: 50
- replace: -random
to: lug
percentage: 10
- replace: -random
to: lu
percentage: 20
alcohol: 40
- replace: -random
to: blub
percentage: 20
alcohol: 70
- replace: -random
to: lerg
percentage: 40
alcohol: 75
- replace: -random
to: gul
percentage: 50
alcohol: 80
- replace: -random
to: ' '
percentage: 100
alcohol: 70
- replace: -random
to: ' '
percentage: 60
alcohol: 40
- replace: -random
to: ' '
percentage: 50
alcohol: 30
- replace: -end
to: '!'
percentage: 40
alcohol: 30
- replace: -random
to: ' *hicks* '
percentage: 80
alcohol: 70
- replace: -random
to: ' *hicks* '
percentage: 15
alcohol: 40
- replace: -space
to: ' *hicks* '
percentage: 5
alcohol: 20
- replace: -end
to: ' *hicks*'
percentage: 70
alcohol: 50
- replace: -all
to: '*rülps*'
percentage: 3
alcohol: 60

View File

@ -0,0 +1,567 @@
# config for Brewery.jar
# -- Settings --
# Defaults are written in []
# Deleting of single settings disables them
# Languagefile to be used (found in plugins/Brewery/languages)
language: en
# If the player wakes up at /home when logging in after excessive drinking (/home plugin must be installed!) [true]
enableHome: true
# Type of the home-teleport: ['cmd: home']
# bed = Player will be teleported to his spawn bed
# 'cmd: home' = /home will be executed by the player. He has to have permissions for it without any delay!
# 'cmd: spawn' = /spawn will be executed by the player.
# 'cmd: whatever' = /whatever will be executed by the player.
homeType: 'cmd: home'
# If the player "wakes up" at a random place when offline for some time while drinking (the places have to be defined with '/brew Wakeup add' through an admin)
# The Player wakes at the nearest of two random places of his world [true]
enableWake: true
# If the Player may have to try multiple times when logging in while extremely drunk [true]
enableLoginDisallow: true
# If the Player faints shortly (gets kicked from the server) if he drinks the max amount of alcohol possible [false]
enableKickOnOverdrink: false
# If the Player vomits on high drunkeness (drops item defined below) [true]
# The item can not be collected and stays on the ground until it despawns.
enablePuke: true
# Item that is dropped multiple times uncollectable when puking [SOUL_SAND]
pukeItem: SOUL_SAND
# Time in seconds until the pukeitems despawn, (mc default is 300 = 5 min) [60]
# If the item despawn time was changed in the spigot.yml, the pukeDespawntime changes as well.
pukeDespawntime: 60
# Consumable Item/strength. Decreases the alcohol level by <strength> when consumed. (list)
drainItems:
- BREAD/4
- MILK_BUCKET/2
# Time (in days) that drunkeness-data stays in memory after a player goes offline, to apply hangover etc. [7]
hangoverDays: 7
# Color the Item information (lore) depending on quality while it is 1. in a barrel and/or 2. in a brewing stand [true, true]
colorInBarrels: true
colorInBrewer: true
# If a Large Barrel can be opened by clicking on any of its blocks, not just Spigot or Sign. This is always true for Small Barrels. [true]
openLargeBarrelEverywhere: true
# Enable checking for Updates, Checks the curseforge api for updates to Brewery [true]
# If an Update is found a Message is logged on Server-start and displayed to OPs joining the game
updateCheck: true
# Autosave interval in minutes [3]
autosave: 3
# Config Version
version: '1.6'
# -- Recipes for Potions --
# name: Different names for bad/normal/good (Formatting codes possible: such as &6)
# ingredients: List of 'material or id,data/amount'
# (Item-ids instead of material are deprecated by bukkit and may not work in the future!)
# A list of materials can be found here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
# You can specify a data (durability) value, omitting it will ignore the data value of the added ingredient
# If Vault is installed normal names can be used instead of material or id, so using Vault is highly recommended.
# Vault will recognize things like "Jungle Leaves" instead of "LEAVES,3"
# cookingtime: Time in real minutes ingredients have to boil
# distillruns: How often it has to be distilled for full alcohol (0=without distilling)
# distilltime: How long (in seconds) one distill-run takes (0=Default time of 40 sec) MC Default would be 20 sec
# wood: Wood of the barrel 0=any 1=Birch 2=Oak 3=Jungle 4=Spruce 5=Acacia 6=Dark Oak
# age: Time in Minecraft-days, the potion has to age in a barrel 0=no aging
# color: Color of the potion after distilling/aging.
# Usable Colors: DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY
# difficulty: 1-10 accuracy needed to get good quality (1 = unaccurate/easy, 10 = very precise/hard)
# alcohol: Absolute amount of alcohol 0-100 in a perfect potion (will be added directly to the player, where 100 means fainting)
# effects: List of effect/level/duration Special potion-effect when drinking, duration in sek.
# Suffix name with 'X' to hide effect from label. Sample: 'POISONX/2/10' (WEAKNESS, INCREASE_DAMAGE, SLOW and SPEED are always hidden.)
# Effects are always hidden in 1.9 and newer, because of changes in the potion mechanics.
# Possible Effects: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
# Level or Duration ranges may be specified with a "-", ex. 'SPEED/1-2/30-40' = lvl 1 and 30 sec at worst and lvl 2 and 40 sec at best
# Ranges also work high-low, ex. 'POISON/3-1/20-5' for weaker effects at good quality.
# Highest possible Duration: 1638 sec. Instant Effects dont need any duration specified.
recipes:
# Example Recipe with every possible entry first:
0:
name: Bad Example/Example/Good Example
ingredients:
- SUGAR_CANE/5
- diamond/1
- Cocoa_Beans/20
- spruce_planks/8
- BEDROCK/1
# - Jungle Leaves/64 # Only with Vault
# - Green Dye/6 # Only with Vault
cookingtime: 3
distillruns: 2
distilltime: 60
wood: 4
age: 11
color: DARK_RED
difficulty: 3
alcohol: 23
effects:
- FIRE_RESISTANCE/20
- HEAL/1
- WEAKNESS/2-3/50-60
- POISONX/1-0/20-0
1:
name: Skunky Wheatbeer/Wheatbeer/Fine Wheatbeer
ingredients:
- WHEAT/3
cookingtime: 8
distillruns: 0
wood: 1
age: 2
color: BRIGHT_GREY
difficulty: 1
alcohol: 5
2:
name: Skunky Beer/Beer/Fine Beer
ingredients:
- WHEAT/6
cookingtime: 8
distillruns: 0
wood: 0
age: 3
color: ORANGE
difficulty: 1
alcohol: 6
3:
name: Skunky Darkbeer/Darkbeer/Fine Darkbeer
ingredients:
- WHEAT/6
cookingtime: 8
distillruns: 0
wood: 4
age: 8
color: BLACK
difficulty: 2
alcohol: 7
4:
name: Awkward Mead/Mead/&6Golden Mead
ingredients:
- SUGAR_CANE/6
cookingtime: 3
distillruns: 0
wood: 2
age: 4
color: ORANGE
difficulty: 2
alcohol: 9
5:
name: Apple Mead/Sweet Apple Mead/&6Sweet Golden Apple Mead
ingredients:
- SUGAR_CANE/6
- APPLE/2
cookingtime: 4
distillruns: 0
wood: 2
age: 4
color: ORANGE
difficulty: 4
alcohol: 12
effects:
- WATER_BREATHINGX/1-2/150
6:
name: Bitter Rum/Spicy Rum/&6Golden Rum
ingredients:
- SUGAR_CANE/14
cookingtime: 5
distillruns: 2
distilltime: 30
wood: 2
age: 14
color: DARK_RED
difficulty: 6
alcohol: 30
effects:
- FIRE_RESISTANCE/1/20-100
- POISONX/1-0/30-0
7:
name: Lousy Vodka/Vodka/Russian Vodka
ingredients:
- POTATO/10
cookingtime: 15
distillruns: 3
age: 0
color: BRIGHT_GREY
difficulty: 4
alcohol: 20
effects:
- WEAKNESS/15
- POISON/10
8:
name: Poor Absinthe/Absinthe/Strong Absinthe
ingredients:
- GRASS/15
cookingtime: 3
distillruns: 6
distilltime: 80
color: GREEN
difficulty: 8
alcohol: 45
effects:
- POISON/20-30
9:
name: Potato soup
ingredients:
- POTATO/5
- GRASS/3
cookingtime: 3
color: PINK
difficulty: 1
effects:
- HEAL/0-1
10:
name: Stale Coffee/Coffee/Strong Coffee
ingredients:
- Cocoa_Beans/12
- MILK_BUCKET/2
cookingtime: 2
color: BLACK
difficulty: 3
effects:
- REGENERATION/1/2-5
- SPEED/1/30-140
# More Recipes ideas: Cachaca, Gin, Whiskey, Tequila, Cider, etc. as well as high quality abbreviations like golden vodka etc.
# I will not add more Recipes to the default config, as they would be public and viewable by users to cheat.
# It is up to the Serveradmin to change and add Recipes, so players cannot cheat from the default config.
# cooked: EVERY possible ingredient and the names for the originating potions after fermenting:
# [Example] MATERIAL_or_id: Name after cooking
cooked:
WHEAT: Fermented wheat
SUGAR_CANE: Sugar brew
APPLE: Apple cider
POTATO: Potatomash
GRASS: Boiled herbs
RED_MUSHROOM: Mushroom brew
Cocoa_Beans: Colored brew
MILK_BUCKET: Milky water
# -- Plugin Compatibility --
# Enable checking of other Plugins (if installed) for Barrel Permissions [true]
useWorldGuard: true
useLWC: true
useGriefPrevention: true
# Enable the Logging of Barrel Inventories to LogBlock [true]
useLogBlock: true
# -- Chat Distortion Settings --
# If written Chat is distorted when the Player is Drunk,
# so that it looks like drunk writing
# How much the chat is distorted depends on how drunk the Player is
# Below are settings for what and how changes in chat occur
enableChatDistortion: true
# Log to the Serverlog what the player actually wrote, before his words were altered [false]
logRealChat: false
# Text after specified commands will be distorted when drunk (list) [- /gl]
distortCommands:
- /gl
- /global
- /fl
- /s
- /letter
- /g
- /l
- /lokal
- /local
- /mail send
- /m
- /msg
- /w
- /whisper
- /reply
- /r
- /t
- /tell
# Distort the Text written on a Sign while drunk [false]
distortSignText: false
# Enclose a Chat text with these Letters to bypass Chat Distortion (Use "," as Separator) (list) [- '[,]']
# Chat Example: Hello i am drunk *I am testing Brewery*
distortBypass:
- '*,*'
- '[,]'
# words: Words and letters that will be altered when chatting while being drunk.
# Will be processed from first to last and a written sentece is altered in that order.
# replace: Word or letter to be replaced. (Special: "-space": replaces space, "-random": insert into random position, "-all": everything, "-start": At Beginning, "-end": At the End.)
# to: What to replace it with.
# pre: Words and Letters before the wanted word (split with ",")
# match: true = one of the "pre"-Words has to be before the wanted Word, false = none of the "pre" Words is allowed before the wanted Word
# alcohol: 1-100 minimum drunkeness after which this word ist replaced
# percentage: Probability of replacing a Word in percent
words:
- replace: s
to: sh
percentage: 90
alcohol: 30
- replace: ch
to: sh
pre: u,s,o,a
match: false
alcohol: 10
percentage: 70
- replace: h
to: hh
pre: sch,h,t
match: false
percentage: 60
alcohol: 20
- replace: th
to: thl
percentage: 40
alcohol: 30
- replace: sch
to: shk
percentage: 60
alcohol: 40
- replace: u
to: uuh
percentage: 20
- replace: y
to: yy
percentage: 60
alcohol: 15
- replace: e
to: ee
percentage: 40
alcohol: 15
- replace: you
to: u
percentage: 40
- replace: u
to: uo
pre: u
match: false
percentage: 60
- replace: that
to: taht
percentage: 20
alcohol: 40
- replace: p
to: b
percentage: 30
- replace: p
to: b
percentage: 70
alcohol: 60
- replace: up
to: ubb
percentage: 80
alcohol: 25
- replace: o
to: oh
percentage: 20
- replace: ei
to: i
percentage: 30
alcohol: 15
- replace: b
to: bb
percentage: 80
alcohol: 40
- replace: '!!!'
to: '!!!111!!!eleven!1!'
pre: '!'
match: false
percentage: 20
alcohol: 70
- replace: '!'
to: '!!'
pre: '!'
match: false
percentage: 90
- replace: drunk
to: dhrkunn
pre: are
match: false
percentage: 70
alcohol: 65
- replace: walk
to: whhealhk
pre: you can, you can still, you can not
match: false
percentage: 80
alcohol: 30
- replace: wtf
to: wft
percentage: 20
alcohol: 40
- replace: lol
to: loool
percentage: 80
alcohol: 10
- replace: afk
to: aafkayyy
percentage: 30
alcohol: 30
- replace: write
to: wreitt
pre: you can,you can still,you can not
match: false
percentage: 80
alcohol: 50
- replace: drink
to: booze
percentage: 80
alcohol: 70
- replace: '?'
to: '????'
pre: '?'
match: false
percentage: 80
alcohol: 40
- replace: -space
to: ''
pre: h,g,w
match: true
alcohol: 10
- replace: -space
to: ''
percentage: 30
alcohol: 35
- replace: -space
to: ''
percentage: 10
- replace: -start
to: dho
percentage: 15
alcohol: 50
- replace: -start
to: hhn
percentage: 10
alcohol: 50
- replace: -random
to: lu
percentage: 10
- replace: -random
to: lug
percentage: 10
alcohol: 50
- replace: -random
to: blub
percentage: 20
alcohol: 80
- replace: -random
to: lerg
percentage: 40
alcohol: 85
- replace: -random
to: gul
percentage: 40
alcohol: 80
- replace: -random
to: ' '
percentage: 100
alcohol: 70
- replace: -random
to: ' '
percentage: 60
alcohol: 40
- replace: -random
to: ' '
percentage: 50
alcohol: 30
- replace: -end
to: '!'
percentage: 40
alcohol: 30
- replace: -random
to: ' *hic* '
percentage: 80
alcohol: 70
- replace: -random
to: ' *hic* '
percentage: 15
alcohol: 40
- replace: -space
to: ' *hic* '
percentage: 5
alcohol: 20
- replace: -end
to: ' *hic*'
percentage: 70
alcohol: 50
- replace: -all
to: '*burp*'
percentage: 3
alcohol: 60
- replace: -all
to: '*burp*'
percentage: 6
alcohol: 80

View File

@ -0,0 +1,572 @@
# config for Brewery.jar
# -- Paramètres --
# Les paramètres par défaut sont entre []
# Supprimer un paramètre le désactive
# Fichier de langage utilisé (trouvable dans plugins/Brewery/languages)
language: fr
# Si le joueur se réveille à son /home lors de sa connexion après un excès alcool (Un plugin de /home est nécessaire!) [true]
enableHome: true
# Type de la téléportation /home: ['cmd: home']
# bed = Le joueur se téléportera à son lit de réapparition.
# 'cmd: home' = /home sera exécuté par le joueur. Il devra avoir la permission sans le délai pour y parvenir!
# 'cmd: spawn' = /spawn sera exécuté par le joueur.
# 'cmd: whatever' = /whatever sera exécuté par le joueur. (Peu importe)
homeType: 'cmd: home'
# Si le joueur se "réveille" à un point aléatoire sur la carte à sa connexion, pendant un excès d'alccol (Les points de réveil doivent être ajoutés avec '/brew Wakeup add' via un administrateur.)
# Le joueur se réveillera aléatoirement parmis les deux points de "réveil" les plus proches de lui [true]
enableWake: true
# Si le joueur reçoit des connexions refusées au serveur s'il est ivre. [true]
enableLoginDisallow: true
# Si le joueur s'évanouit (il sera kické) lorsqu'il boit trop d'alcool [false]
enableKickOnOverdrink: false
# Si le joueur vomit en cas d'alcoolémie élevée (Le type d'objet "droppé" est configurable en dessous) [true]
# L'objet ne peut pas être collecté et reste sur le sol jusqu'à ce qu'il disparaisse
enablePuke: true
# L'objet utilisé pour représenter le vomit [SOUL_SAND]
pukeItem: SOUL_SAND
# Time in seconds until the pukeitems despawn, (mc default is 300 = 5 min) [60]
# If the item despawn time was changed in the spigot.yml, the pukeDespawntime changes as well.
pukeDespawntime: 60
# Consommables Objet/Force. Réduit le montant d'alcool par <Force> lors de la consommation. (list)
drainItems:
- BREAD/4
- MILK_BUCKET/2
# Temps (en jours) pour que les données d'ivresse restent sauvergardées lorsque le joueur est déconnecté, pour appliquer les effets. [7]
hangoverDays: 7
# Colorer les informations d'objets (lore) au dépend de la qualité dans un tonneau et/ou dans un stand de brassage (l'alambic) [true, true]
colorInBarrels: true
colorInBrewer: true
# Si le grand tonneau peut être ouvert en cliquant sur n'importe quel bloc, non seulement le robinet ou le panneau. Toujours "true" pour les petits tonneaux. [true]
openLargeBarrelEverywhere: true
# Enable checking for Updates, Checks the curseforge api for updates to Brewery [true]
# If an Update is found a Message is logged on Server-start and displayed to OPs joining the game
updateCheck: true
# Intervale de la sauvegarde automatique en minutes [3]
autosave: 3
# Version de configuration
version: '1.6'
# -- Recette pour les boissons --
# name: Différents noms pour la mauvaise/moyen/bonne qualité (Les codes de mise en forme sont pris en charge: comme par exemple &6 pour la couleur Or.)
# ingredients: Liste des 'matériaux ou id,data/montant'
# (Les id d'objets à la place des matériaux sont obsolètes pour bukkit et pourraient ne pas fonctionner dans le futur!)
# Ex: 'SUGAR_CANE'
# Une liste des matériaux peuvent-être trouvés ici: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
# Vous pouvez spécifier une data (Ex: 5,3 -> Planche de bois de jungle), si vous ne le faites pas la data ne sera pas prise en compte (Ex : 5 -> Bois en général)
# If Vault is installed normal names can be used instead of material or id, so using Vault is highly recommended.
# Vault will recognize things like "Jungle Leaves" instead of "5,3"
# cookingtime: Temps en minutes réelles durant lesquelles les ingrédients devront bouillir
# distillruns: Combien de fois le breuvage devra être distillé pour un alcool de qualité (0=Ne pas distiller)
# distilltime: How long (in seconds) one distill-run takes (0=Default time of 40 sec) MC Default would be 20 sec
# wood: Type de bois du baril 0=aucun 1=Bouleau 2=Chêne 3=Jungle 4=Pin 5=Acacia 6=Chêne Noir
# age: Temps en jours de Minecraft, la potion devra être âgée dans un baril. 0=Pas besoin d'âge
# color: Couleur de la potion après distillation/avoir laissé vieillir.
# Couleurs disponibles: DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY (Dans l'ordre : Rouge foncé, Rouge, Rouge clair, Orange, Rose, Bleu, Cyan, Eau, Vert, Noir, Gris, Gris clair)
# difficulty: 1-10 précision nécessaire pour obtenir une bonne qualité (1 = imprécis/facile, 10 = très précis/difficile)
# alcohol: Le montant d'alcool absolu dans une boisson parfaite (cela sera ajouté directement au joueur, où 100% entraînera l'évanouissement), un degré d'alcooléisme en fait
# effects: Liste des effets/durée en secondes lors de la consommation.
# Rajouter le suffixe 'X' pour le cacher du label. Exemple: POISONX/10
# (WEAKNESS, INCREASE_DAMAGE, SLOW et SPEED sont toujours cachés.)
# Effects are always hidden in 1.9 and newer, because of changes in the potion mechanics.
# Effets posssible: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
# POUR LES EFFETS EN FONCTIONS DE LA QUALITE : Les Niveaux (I ou II) ou les Intervalles de durées d'effets doivent être spécifiés avec un "-".
# Ex: 'SPEED/1-2/30-40' => Vitesse niveau 1 et durée de 30 sec pour la pire qualité, et niveau 2 et durée de 40 sec pour la meilleure.
# Il est aussi possible de faire l'inverse, c'est à dire que le schéma "Meilleure qualité, meilleur effets" soit "Meilleure qualité, effets moins puissants.
# Cela peut-être utile pour des potions avec l'effet poison pour empoisonner moins avec une bonne qualité.
# Ex: 'POISON/3-1/20-5' => Poison de niveau 3 durant 20 sec à la moins bonne qualité et de niveau 1 et de durée 5 sec à la meilleure.
# Durées possibles maximum: 1638 sec. Les effets instantanés n'ont pas besoin d'avoir une durée spécifiée (Ex : Les potions de Soin instantané).
recipes:
# Exemple de recette avec tous les paramètres possibles :
0:
name: Mauvais Exemple/Exemple/Bonne Exemple
ingredients:
- SUGAR_CANE/5
- diamond/1
- Cocoa_Beans/20
- spruce_planks/8
- BEDROCK/1
# - Jungle Leaves/64 # Only with Vault
# - Green Dye/6 # Only with Vault
cookingtime: 3
distillruns: 2
distilltime: 60
wood: 4
age: 11
color: DARK_RED
difficulty: 3
alcohol: 23
effects:
- FIRE_RESISTANCE/20
- HEAL/1
- WEAKNESS/2-3/50-60
- POISONX/1-0/20-0
1:
name: Bière Blanche Fade/Bière Blanche/Bonne Bière Blanche
ingredients:
- WHEAT/3
cookingtime: 8
distillruns: 0
wood: 1
age: 2
color: BRIGHT_GREY
difficulty: 1
alcohol: 5
2:
name: Bière Fade/Bière/Bonne Bière
ingredients:
- WHEAT/6
cookingtime: 8
distillruns: 0
wood: 0
age: 3
color: ORANGE
difficulty: 1
alcohol: 6
3:
name: Bière Brune Fade/Bière Brune/Bonne Bière Brune
ingredients:
- WHEAT/6
cookingtime: 8
distillruns: 0
wood: 4
age: 8
color: BLACK
difficulty: 2
alcohol: 7
4:
name: Hydromel Bizarre/Hydromel/&6Hydromel Doré
ingredients:
- SUGAR_CANE/6
cookingtime: 3
distillruns: 0
wood: 2
age: 4
color: ORANGE
difficulty: 2
alcohol: 9
5:
name: Hydromel de Pommes/Doux Hydromel de Pommes/&6Doux Hydromel de Pommes Dorées
ingredients:
- SUGAR_CANE/6
- APPLE/2
cookingtime: 4
distillruns: 0
wood: 2
age: 4
color: ORANGE
difficulty: 4
alcohol: 12
effects:
- WATER_BREATHINGX/1-2/150
6:
name: Rhum Amer/Rhum Epicé/&6Rhum Doré
ingredients:
- SUGAR_CANE/14
cookingtime: 5
distillruns: 2
distilltime: 30
wood: 2
age: 14
color: DARK_RED
difficulty: 6
alcohol: 30
effects:
- FIRE_RESISTANCE/1/20-100
- POISONX/1-0/30-0
7:
name: Vodka Sale/Vodka/Vodka Russe
ingredients:
- POTATO/10
cookingtime: 15
distillruns: 3
age: 0
color: BRIGHT_GREY
difficulty: 4
alcohol: 20
effects:
- WEAKNESS/15
- POISON/10
8:
name: Absinthe pauvre/Absinthe/Absinthe forte
ingredients:
- GRASS/15
cookingtime: 3
distillruns: 6
distilltime: 80
color: GREEN
difficulty: 8
alcohol: 45
effects:
- POISON/20-30
9:
name: Potato soup
ingredients:
- POTATO/5
- GRASS/3
cookingtime: 3
color: PINK
difficulty: 1
effects:
- HEAL/0-1
10:
name: Café fétide/Café/Café fort
ingredients:
- Cocoa_Beans/12
- MILK_BUCKET/2
cookingtime: 2
color: BLACK
difficulty: 3
effects:
- REGENERATION/1/2-5
- SPEED/1/30-140
# Plus d'idées de recettes: Cachaça, Gin, Whisky, Tequila, Cidre, etc. et abréviations de haute qualité comme la vodka dorée etc.
# Je n'ajouterai pas plus de recettes à la configuration par défaut, car elles seront publiques et visibles par tous les utilisateurs et parce que les joueurs pourraient tricher en les voyant.
# Ce sera aux Admins des serveurs de changer et d'ajouter les recettes, ainsi les joueurs ne pourront pas tricher avec les configuration de base.
# cooked: CHAQUE ingrédient possible avec le nom donné après la fermentation (la cuisson):
# [Exemple] MATERIEL_ou_id: Nom après la cuisson
cooked:
WHEAT: Blé fermenté
SUGAR_CANE: Sucre fermenté
APPLE: Cidre de pommes
POTATO: Purée de Pommes de Terre
GRASS: Herbes bouillies
RED_MUSHROOM: Champignons fermentés
Cocoa_Beans: Fermentation colorée
MILK_BUCKET: Eau laiteuse
# -- Compatibilité entre Plugins --
# Activer la vérification des autres plugins (si installés) pour les permissions des tonneaux. [true]
useWorldGuard: true
useLWC: true
useGriefPrevention: true
# Activer l'historique du contenu des tonneaux avec LogBlock [true]
useLogBlock: true
# -- Paramètres de la distorsion du Chat --
# If written Chat is distorted when the Player is Drunk,
# so that it looks like drunk writing
# How much the chat is distorted depends on how drunk the Player is
# Below are settings for what and how changes in chat occur
enableChatDistortion: true
# Ecrire dans les "logs" du serveur ce que le joueur devrait dire, à la place de la distorsion. [false]
logRealChat: false
# Distordre le texte dans le Chat après les commandes spécifiées (list) [- /gl]
distortCommands:
- /gl
- /global
- /fl
- /s
- /letter
- /g
- /l
- /lokal
- /local
- /mail send
- /m
- /msg
- /w
- /whisper
- /reply
- /r
- /t
- /tell
# Distordre le texte sur les panneaux pendant l'ivresse [false]
distortSignText: false
# Entourer les textes avec ces caractères pour ignorer la distorsion (Utilisez "," comme un séparateur) (list) [- '[,]']
# Chat Example: Hello i am drunk *I am testing Brewery*
distortBypass:
- '*,*'
- '[,]'
# words: Les mots et les lettres altérées dans le chat lors d'un état d'ivresse.
# Commence du haut jusqu'au bas. Les phrases sont altérées par l'ordre écrit.
# replace: Mot ou lettre à remplacer (Spécial: "-space": remplace les espaces, "-random": s'insère dans une position aléatoire, "-all": Toute la ligne, "-start": Au début, "-end": A la fin.)
# to: Ce qui remplacera.
# pre: Les mots et les lettres avant le mot désiré (séparez avec ",")
# match: true = Si un des "Pre-Mots" est nécessaire avant le mot désiré, false = Aucun des "Pre-Mots" n'est autorisé avant le mot désiré.
# alcohol: 1-100 Le montant minimal d'alcool pour que la distorsion fonctionne.
# percentage: Probabilité en pourcentage que le mot soit remplacé.
words:
- replace: s
to: sh
percentage: 90
alcohol: 30
- replace: ch
to: sh
pre: u,s,o,a
match: false
alcohol: 10
percentage: 70
- replace: h
to: hh
pre: sch,h,t
match: false
percentage: 60
alcohol: 20
- replace: th
to: thl
percentage: 40
alcohol: 30
- replace: sch
to: shk
percentage: 60
alcohol: 40
- replace: u
to: uuh
percentage: 20
- replace: y
to: yy
percentage: 60
alcohol: 15
- replace: e
to: ee
percentage: 40
alcohol: 15
- replace: toi
to: twa
percentage: 40
- replace: u
to: uo
pre: u
match: false
percentage: 60
- replace: ça
to: sha
percentage: 20
alcohol: 40
- replace: p
to: b
percentage: 30
- replace: p
to: b
percentage: 70
alcohol: 60
- replace: up
to: ubb
percentage: 80
alcohol: 25
- replace: o
to: oh
percentage: 20
- replace: ei
to: i
percentage: 30
alcohol: 15
- replace: b
to: bb
percentage: 80
alcohol: 40
- replace: '!!!'
to: '!!!?!???!?!?!!!'
pre: '!'
match: false
percentage: 20
alcohol: 70
- replace: '!'
to: '!!'
pre: '!'
match: false
percentage: 90
- replace: ivre
to: shaoul
pre: es, êtes
match: false
percentage: 70
alcohol: 65
- replace: marcher
to: mrashere
pre: tu peux, vous pouvez, tu ne peux pas, vous ne pouvez pas
match: false
percentage: 80
alcohol: 30
- replace: wtf
to: wft
percentage: 20
alcohol: 40
- replace: lol
to: loool
percentage: 80
alcohol: 10
- replace: afk
to: aaAAaafffFFFfffKAAAAAA
percentage: 30
alcohol: 30
- replace: écrire
to: ekrir
pre: tu peux, vous pouvez, tu ne peux pas, vous ne pouvez pas
match: false
percentage: 80
alcohol: 50
- replace: drink
to: booze
percentage: 80
alcohol: 70
- replace: '?'
to: '????'
pre: '?'
match: false
percentage: 80
alcohol: 40
- replace: -space
to: ''
pre: h,g,w
match: true
alcohol: 10
- replace: -space
to: ''
percentage: 30
alcohol: 35
- replace: -space
to: ''
percentage: 10
- replace: -start
to: dho
percentage: 15
alcohol: 50
- replace: -start
to: hhn
percentage: 10
alcohol: 50
- replace: -random
to: lu
percentage: 10
- replace: -random
to: lug
percentage: 10
alcohol: 50
- replace: -random
to: blub
percentage: 20
alcohol: 80
- replace: -random
to: lerg
percentage: 40
alcohol: 85
- replace: -random
to: gul
percentage: 40
alcohol: 80
- replace: -random
to: ' '
percentage: 100
alcohol: 70
- replace: -random
to: ' '
percentage: 60
alcohol: 40
- replace: -random
to: ' '
percentage: 50
alcohol: 30
- replace: -end
to: '!'
percentage: 40
alcohol: 30
- replace: -random
to: ' *hic* '
percentage: 80
alcohol: 70
- replace: -random
to: ' *hic* '
percentage: 15
alcohol: 40
- replace: -space
to: ' *hic* '
percentage: 5
alcohol: 20
- replace: -end
to: ' *hic*'
percentage: 70
alcohol: 50
- replace: -all
to: '*burp*'
percentage: 3
alcohol: 60
- replace: -all
to: '*burp*'
percentage: 6
alcohol: 80

View File

@ -0,0 +1,567 @@
# config di Brewery.jar
# -- Opzioni --
# I valori di default sono scritti fra []
# Cancellare una voce la disabilita
# Lingua da usare (fra quelle in plugins/Brewery/languages)
language: it
# Se il giocatore si sveglia nella sua /home dopo aver bevuto troppo(il plugin di /home deve essere installato!) [true]
enableHome: true
# Tipo di teletrasporto alla home ['cmd: home']
# bed = Il giocatore sarà teletrasportato al suo letto
# 'cmd: home' = /home sarà eseguito dal giocatore. Deve avere il permesso di farlo senza ritardi!
# 'cmd: spawn' = /spawn sarà eseguito dal giocatore
# 'cmd: faitu' = /faitu sarà eseguito dal giocatore.
homeType: 'cmd: home'
# Se il giocatore si risveglia in un posto a caso dopo essere andato offline mentre beveva (questi posti devono essere definiti con '/brew Wakeup add' da un admin)
# Il giocatore si risveglia al punto di risveglio più vicino [true]
enableWake: true
# Se il giocatore debba provare più volte per loggare da molto ubriaco [true]
enableLoginDisallow: true
# Se il giocatore viene espulso dal server se raggiunge la percentuale massima di alcol [false]
enableKickOnOverdrink: false
# Se il giocatore vomita se molto sbronzo [true]
# L'oggetto non può essere raccolto e resta per terra finché non sparisce.
enablePuke: true
# L'oggetto droppato in massa quando si vomita che dovrebbe rappresentare il vomito [SOUL_SAND]
pukeItem: SOUL_SAND
# Tempo in secondi perché il vomito sparisca (il valore di minecraft di default è 300 = 5 min) [60]
# Se il tempo di scomparsa viene cambiato in spigot.yml anche pukeDespawntime cambia.
pukeDespawntime: 60
# Oggetto consumabile/forza. Questi oggetti se consumati calano il livello di alcool (della "forza" che avevi impsotato) (list)
drainItems:
- BREAD/4
- MILK_BUCKET/2
# Tempo in giorni che la sbronza resta in memoria dopo che il giocatore va offline, cioè il tempo per cui i postumi della sbornia durano. [7]
hangoverDays: 7
# Colora la descrizione dell'item in base alla qualità mentre è in un barile o in un alambicco [true, true]
colorInBarrels: true
colorInBrewer: true
# Se un barile grande può essere aperto cliccandoci sopra, non solo sul cartello e sulla staccionata. Questo è sempre true per i barili piccoli. [true]
openLargeBarrelEverywhere: true
# Abilita il controllo degli aggiornamenti, controlla l'API di CurseForge per eventuali aggiornamenti di Brewery [true]
# Se quando un aggiornamento viene trovato un messaggio è loggato e mostrato agli OPs quando entrano in gioco.
updateCheck: true
# Intervallo di autosalvataggio in minuti [3]
autosave: 3
# Versione del config
version: '1.6'
# -- Ricette per pozioni --
# name: Tre nomi diversi per diverse qualità (cattivo/normale/buono). I codici come &6 possono essere usati.
# ingredients: Lista degli ingredienti nel formato materiale o id,dati/quantità
# (Gli id invece dei materiali sono "disapprovati" da Bukkit e potrebbero non funzionare in futuro!)
# Una lista di materiali può essere trovata qui: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
# Puoi specificare dei dati dell'oggetto, ma se omesso sarà semplicemente ignorato.
# Se Vault è installato i nomi normali possono essere usati invece del materiale o dell'id quindi l'uso di Vault è fortemente consigliato.
# Vault riconoscerà cose come "Jungle Leaves" invece di "LEAVES,3".
# cookingtime: Tempo in minuti richiesto dagli ingredienti per bollire
# distillruns: Quanto spesso deve essere distillato per ottenere la versione perfetta con il volume alcolico impostato (0=non serve distillare).
# distilltime: How long (in seconds) one distill-run takes (0=Default time of 40 sec) MC Default would be 20 sec
# wood: Legno del barile 0=qualiasi 1=Betulla 2=Quercia 3=Mogano 4=Abete 5=Acacia 6=Quercia nera
# age: Tempo in giorni di Minecraft per cui la pozione deve essere invecchiata in un barile (0=nessun invecchiamento).
# color: Colore della pozione dopo essere stata distillata/invecchiata
# Colori utilizzabili: DARK_RED, RED, BRIGHT_RED, ORANGE, PINK, BLUE, CYAN, WATER, GREEN, BLACK, GREY, BRIGHT_GREY
# difficoltà: Precisione richiesta per avere la migliore qualità da 1 a 10(1 = spreciso/più facile, 10 = molto preciso/più difficile)
# alcohol: Volume alcolico da 0 a 100 nella versione perfetta (sarà aggiunta direttamente al giocatore, dove 100 è la quantità massima di alcohol assorbibile.
# effects: Eventuali effetti come quelli delle pozioni nel formato di effetto/livello/durata.
# Aggiungere il suffisso 'X' per nascondere l'effetto dalla descrizione. Esempio: 'POISONX/2/10' (gli effetti WEAKNESS, INCREASE_DAMAGE, SLOW and SPEED sono sempre nascosti).
# Gli effetti sono sempre nascosti dalla 1.9 in poi, per via dei cambiamenti nelle meccaniche delle pozioni.
# Lista di effetti possibili: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
# Intervalli di livelli o durate possono essere specificati con un "-", per esempio 'SPEED/1-2/30-40'. Ciò significa nel peggior caso livello 1 e 30 secondi di durata e livello 2 e 40 secondi nel migliore.
# Gli intervalli funzionano anche in ordine decrescente, per effetti più deboli a qualità maggiori. Esempio: 'POISON/3-1/20-5'.
# La durata massima possibile è 1638 secondi. Gli effetti instantaner non hanno bisogno che la durata sia specificata.
recipes:
# Ricetta di esempio con ogni opzione possibile:
0:
name: Cattivo esempio/Esempio/Buon esempio
ingredients:
- SUGAR_CANE/5
- diamond/1
- Cocoa_Beans/20
- spruce_planks/8
- BEDROCK/1
# - Jungle Leaves/64 # Solo con Vault
# - Green Dye/6 # Solo con Vault
cookingtime: 3
distillruns: 2
distilltime: 60
wood: 4
age: 11
color: DARK_RED
difficulty: 3
alcohol: 23
effects:
- FIRE_RESISTANCE/20
- HEAL/1
- WEAKNESS/2-3/50-60
- POISONX/1-0/20-0
1:
name: Birra di frumento puzzolente/Birra di frumento/Birra di frumento pregiata
ingredients:
- WHEAT/3
cookingtime: 8
distillruns: 0
wood: 1
age: 2
color: BRIGHT_GREY
difficulty: 1
alcohol: 5
2:
name: Birra puzzolente/Birra/Birra pregiata
ingredients:
- WHEAT/6
cookingtime: 8
distillruns: 0
wood: 0
age: 3
color: ORANGE
difficulty: 1
alcohol: 6
3:
name: Birra scura puzzolente/Birra scura/Birra scura pregiata
ingredients:
- WHEAT/6
cookingtime: 8
distillruns: 0
wood: 4
age: 8
color: BLACK
difficulty: 2
alcohol: 7
4:
name: Idromele scarso/Idromele/&6Idromele dorato
ingredients:
- SUGAR_CANE/6
cookingtime: 3
distillruns: 0
wood: 2
age: 4
color: ORANGE
difficulty: 2
alcohol: 9
5:
name: Idromele di mele/Idromele di mele dolci/&6Idromele di mele dolci dorato
ingredients:
- SUGAR_CANE/6
- APPLE/2
cookingtime: 4
distillruns: 0
wood: 2
age: 4
color: ORANGE
difficulty: 4
alcohol: 12
effects:
- WATER_BREATHINGX/1-2/150
6:
name: Rum amaro/Rum speziato/&6Rum dorato
ingredients:
- SUGAR_CANE/14
cookingtime: 5
distillruns: 2
distilltime: 30
wood: 2
age: 14
color: DARK_RED
difficulty: 6
alcohol: 30
effects:
- FIRE_RESISTANCE/1/20-100
- POISONX/1-0/30-0
7:
name: Vodka schifosa/Vodka/Vodka russa
ingredients:
- POTATO/10
cookingtime: 15
distillruns: 3
age: 0
color: BRIGHT_GREY
difficulty: 4
alcohol: 20
effects:
- WEAKNESS/15
- POISON/10
8:
name: Assenzio scarso/Assenzio/Assenzio forte
ingredients:
- GRASS/15
cookingtime: 3
distillruns: 6
distilltime: 80
color: GREEN
difficulty: 8
alcohol: 45
effects:
- POISON/20-30
9:
name: Zuppa di patate
ingredients:
- POTATO/5
- GRASS/3
cookingtime: 3
color: PINK
difficulty: 1
effects:
- HEAL/0-1
10:
name: Caffè stantio/Caffè/Caffè forte
ingredients:
- Cocoa_Beans,3/12
- MILK_BUCKET/2
cookingtime: 2
color: BLACK
difficulty: 3
effects:
- REGENERATION/1/2-5
- SPEED/1/30-140
# Altre idee per ricette: Cachaca, Gin, Whiskey, Tequila, Sidro, ecc. Altri nomi per le altre qualità come Vodka Dorata ecc.
# Io non aggiungerò altre ricette al config di default, perché sarebbero pubbliche e visibiliad altri utenti per barare.
# Aggiungere e cambiare ricette è compito del Server Admin, così che i giocatori non possano barare guardando il config di default.
# cooked: OGNI possibile ingrediente e i nomi per la pozione originatasi dopo la fermentazione.
# (Esempio) MATERIALE_o_id: Nome dopo la cottura
cooked:
WHEAT: Frumento fermentato
SUGAR_CANE: Miscela zuccherata
APPLE: Sidro di mele
POTATO: Purè di patate
GRASS: Erbe bollite
RED_MUSHROOM: Miscela ai funghi
Cocoa_Beans: Miscela colorata
MILK_BUCKET: Acqua lattea
# -- Compatibilità con altri plugin --
# Abilita il controllo della presenza di altri plugin per i permessi relativi ai barili[true]
useWorldGuard: true
useLWC: true
useGriefPrevention: true
# Abilita il logging degli inventari dei barili [true]
useLogBlock: true
# -- Imostazioni di distorsione della chat --
# If written Chat is distorted when the Player is Drunk,
# so that it looks like drunk writing
# How much the chat is distorted depends on how drunk the Player is
# Below are settings for what and how changes in chat occur
enableChatDistortion: true
# Salva nel log del server quello che il giocatore ha realmente scritto, prima che le sue parole venissero alterate [false]
logRealChat: false
# Il testo seguente ad alcuni comandi definiti qui sotto sarà distorto da ubriachi [- /gl]
distortCommands:
- /gl
- /global
- /fl
- /s
- /letter
- /g
- /l
- /lokal
- /local
- /mail send
- /m
- /msg
- /w
- /whisper
- /reply
- /r
- /t
- /tell
# Distorci il testo sui cartelli quando sei ubriaco [false]
distortSignText: false
# Definisci dei caratteri fra cui inserire le parole per evitare la distorsione della chat (usa "," come separatore) (list) [- '[,]']
# Chat Example: Hello i am drunk *I am testing Brewery*
distortBypass:
- '*,*'
- '[,]'
# words: Lettere e parole che saranno alterate chattando durante la sbronza.
# Saranno elaborate dalla prima all'ultima e la frase scritta viene alterata in quell'ordine.
# replace: Lettere o parole da sostituire. (Special: "-space": sostituisco spazio, "-random": lo mette in una posizione a caso, "-all": tutto, "-start": all'inizio, "-end": alla fine.)
# to: Con cosa sostituirle.
# pre: Lettere e parole prima della parola voluta (separa con ",").
# match: true = una delle parole specificate in "pre" deve precedere la parola bersaglio, false = nessuna delle parole in "pre" deve trovarsi prima della parola bersaglio.
# alcohol: Ubriachezza minima da 1 a 100 perché la parola sia alterata.
# percentage: Probabilità di sostituzione in perchentuale.
words:
- replace: s
to: sh
percentage: 90
alcohol: 30
- replace: ch
to: sh
pre: u,s,o,a
match: false
alcohol: 10
percentage: 70
- replace: h
to: hh
pre: sch,h,t
match: false
percentage: 60
alcohol: 20
- replace: th
to: thl
percentage: 40
alcohol: 30
- replace: sch
to: shk
percentage: 60
alcohol: 40
- replace: u
to: uuh
percentage: 20
- replace: y
to: yy
percentage: 60
alcohol: 15
- replace: e
to: ee
percentage: 40
alcohol: 15
- replace: tu
to: te
percentage: 40
- replace: u
to: uo
pre: u
match: false
percentage: 60
- replace: that
to: taht
percentage: 20
alcohol: 40
- replace: p
to: b
percentage: 30
- replace: p
to: b
percentage: 70
alcohol: 60
- replace: up
to: ubb
percentage: 80
alcohol: 25
- replace: o
to: oh
percentage: 20
- replace: ei
to: i
percentage: 30
alcohol: 15
- replace: b
to: bb
percentage: 80
alcohol: 40
- replace: '!!!'
to: '!!!111!!!undici!1!'
pre: '!'
match: false
percentage: 20
alcohol: 70
- replace: '!'
to: '!!'
pre: '!'
match: false
percentage: 90
- replace: sbronzo
to: shhbronnzo
pre: are
match: false
percentage: 70
alcohol: 65
- replace: cammina
to: caahkhhmmminnna
pre: puoi, puoi ancora, non puoi
match: false
percentage: 80
alcohol: 30
- replace: wtf
to: wft
percentage: 20
alcohol: 40
- replace: lol
to: loool
percentage: 80
alcohol: 10
- replace: afk
to: aafkayyy
percentage: 30
alcohol: 30
- replace: scrivere
to: shhkrihvehrre
pre: puoi,puoi ancora,non puoi
match: false
percentage: 80
alcohol: 50
- replace: drink
to: booze
percentage: 80
alcohol: 70
- replace: '?'
to: '????'
pre: '?'
match: false
percentage: 80
alcohol: 40
- replace: -space
to: ''
pre: h,g,w
match: true
alcohol: 10
- replace: -space
to: ''
percentage: 30
alcohol: 35
- replace: -space
to: ''
percentage: 10
- replace: -start
to: dho
percentage: 15
alcohol: 50
- replace: -start
to: hhn
percentage: 10
alcohol: 50
- replace: -random
to: lu
percentage: 10
- replace: -random
to: lug
percentage: 10
alcohol: 50
- replace: -random
to: blub
percentage: 20
alcohol: 80
- replace: -random
to: lerg
percentage: 40
alcohol: 85
- replace: -random
to: gul
percentage: 40
alcohol: 80
- replace: -random
to: ' '
percentage: 100
alcohol: 70
- replace: -random
to: ' '
percentage: 60
alcohol: 40
- replace: -random
to: ' '
percentage: 50
alcohol: 30
- replace: -end
to: '!'
percentage: 40
alcohol: 30
- replace: -random
to: ' *hic* '
percentage: 80
alcohol: 70
- replace: -random
to: ' *hic* '
percentage: 15
alcohol: 40
- replace: -space
to: ' *hic* '
percentage: 5
alcohol: 20
- replace: -end
to: ' *hic*'
percentage: 70
alcohol: 50
- replace: -all
to: '*burp*'
percentage: 3
alcohol: 60
- replace: -all
to: '*burp*'
percentage: 6
alcohol: 80

View File

@ -1,8 +1,9 @@
name: ${project.name}
version: ${project.version}
main: com.dre.brewery.P
authors: [Milan Albrecht, Frank Baumann, ProgrammerDan]
softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention, Vault, Citadel]
authors: [Milan Albrecht, Frank Baumann, ProgrammerDan, Daniel Saukel]
api-version: 1.13
commands:
brewery:
description: Command for Administration

View File

@ -9,8 +9,6 @@ import org.bukkit.block.BlockFace;
import org.bukkit.inventory.ItemStack;
import org.bukkit.Effect;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.material.Cauldron;
import org.bukkit.material.MaterialData;
public class BCauldron {
public static CopyOnWriteArrayList<BCauldron> bcauldrons = new CopyOnWriteArrayList<>();
@ -36,8 +34,7 @@ public class BCauldron {
public void onUpdate() {
// Check if fire still alive
if (!block.getChunk().isLoaded() || block.getRelative(BlockFace.DOWN).getType() == Material.FIRE || block.getRelative(BlockFace.DOWN).getType() == Material.STATIONARY_LAVA
|| block.getRelative(BlockFace.DOWN).getType() == Material.LAVA) {
if (!block.getChunk().isLoaded() || block.getRelative(BlockFace.DOWN).getType() == Material.FIRE || LegacyUtil.isLava(block.getRelative(BlockFace.DOWN).getType())) {
// add a minute to cooking time
state++;
if (someRemoved) {
@ -74,7 +71,7 @@ public class BCauldron {
// get cauldron from block and add given ingredient
public static boolean ingredientAdd(Block block, ItemStack ingredient) {
// if not empty
if (getFillLevel(block) != 0) {
if (LegacyUtil.getFillLevel(block) != 0) {
BCauldron bcauldron = get(block);
if (bcauldron != null) {
bcauldron.add(ingredient);
@ -100,13 +97,13 @@ public class BCauldron {
byte data = block.getData();
if (data > 3) {
data = 3;
block.setData(data);
LegacyUtil.setData(block, data);
} else if (data <= 0) {
bcauldrons.remove(bcauldron);
return false;
}
data -= 1;
block.setData(data);
LegacyUtil.setData(block, data);
if (data == 0) {
bcauldrons.remove(bcauldron);
@ -125,24 +122,6 @@ public class BCauldron {
return false;
}
// 0 = empty, 1 = something in, 2 = full
public static byte getFillLevel(Block block) {
if (block.getType() == Material.CAULDRON) {
MaterialData data = block.getState().getData();
if (data instanceof Cauldron) {
Cauldron cauldron = (Cauldron) data;
if (cauldron.isEmpty()) {
return 0;
} else if (cauldron.isFull()) {
return 2;
} else {
return 1;
}
}
}
return 0;
}
// prints the current cooking time to the player
public static void printTime(Player player, Block block) {
if (!player.hasPermission("brewery.cauldron.time")) {
@ -161,7 +140,7 @@ public class BCauldron {
// reset to normal cauldron
public static void remove(Block block) {
if (getFillLevel(block) != 0) {
if (LegacyUtil.getFillLevel(block) != 0) {
BCauldron bcauldron = get(block);
if (bcauldron != null) {
bcauldrons.remove(bcauldron);

View File

@ -64,7 +64,7 @@ public class BRecipe {
if (durability == -1 && vaultItem.getSubTypeId() != 0) {
durability = vaultItem.getSubTypeId();
}
if (mat == Material.LEAVES) {
if (mat.name().contains("LEAVES")) {
if (durability > 3) {
durability -= 4; // Vault has leaves with higher durability
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,196 @@
package com.dre.brewery;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Levelled;
import org.bukkit.material.Cauldron;
import org.bukkit.material.MaterialData;
import org.bukkit.material.Tree;
import org.bukkit.material.Wood;
public class LegacyUtil {
private static Method GET_MATERIAL;
private static Method GET_BLOCK_TYPE_ID_AT;
private static Method SET_DATA;
static {
// -1.12.2 methods
try {
GET_MATERIAL = Material.class.getDeclaredMethod("getMaterial", int.class);
GET_BLOCK_TYPE_ID_AT = World.class.getDeclaredMethod("getBlockTypeIdAt", Location.class);
} catch (NoSuchMethodException | SecurityException e) {
}
// 1.13+ methods
try {
SET_DATA = Class.forName(Bukkit.getServer().getClass().getPackage().getName() + ".block.CraftBlock").getDeclaredMethod("setData", byte.class);
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException e) {
}
}
public static final Material CLOCK = get("CLOCK", "WATCH");
public static final Material OAK_STAIRS = get("OAK_STAIRS", "WOOD_STAIRS");
public static final Material SPRUCE_STAIRS = get("SPRUCE_STAIRS", "SPRUCE_WOOD_STAIRS");
public static final Material BIRCH_STAIRS = get("BIRCH_STAIRS", "BIRCH_WOOD_STAIRS");
public static final Material JUNGLE_STAIRS = get("JUNGLE_STAIRS", "JUNGLE_WOOD_STAIRS");
public static final Material ACACIA_STAIRS = get("ACACIA_STAIRS");
public static final Material DARK_OAK_STAIRS = get("DARK_OAK_STAIRS");
private static Material get(String name) {
try {
return Material.valueOf(name);
} catch (IllegalArgumentException e) {
return null;
}
}
private static Material get(String newName, String oldName) {
try {
return Material.valueOf(P.use1_13 ? newName : oldName);
} catch (IllegalArgumentException e) {
return null;
}
}
public static boolean isWoodPlanks(Material type) {
return type.name().contains("PLANKS") || type.name().equals("WOOD");
}
public static boolean isWoodStairs(Material type) {
return type == OAK_STAIRS || type == SPRUCE_STAIRS || type == BIRCH_STAIRS || type == JUNGLE_STAIRS
|| (type == ACACIA_STAIRS && ACACIA_STAIRS != null) || (type == DARK_OAK_STAIRS && DARK_OAK_STAIRS != null);
}
public static boolean isFence(Material type) {
return type.name().endsWith("FENCE");
}
public static boolean isSign(Material type) {
return type.name().equals("SIGN_POST") || type == Material.SIGN || type == Material.WALL_SIGN;
}
// LAVA and STATIONARY_LAVA are merged as of 1.13
public static boolean isLava(Material type) {
return type.name().equals("STATIONARY_LAVA") || type == Material.LAVA;
}
public static boolean areStairsInverted(Block block) {
if (!P.use1_13) {
MaterialData data = block.getState().getData();
return data instanceof org.bukkit.material.Stairs && (((org.bukkit.material.Stairs) data).isInverted());
} else {
BlockData data = block.getBlockData();
return data instanceof org.bukkit.block.data.type.Stairs && ((org.bukkit.block.data.type.Stairs) data).getHalf() == org.bukkit.block.data.type.Stairs.Half.TOP;
}
}
public static byte getWoodType(Block wood) {
TreeSpecies woodType = null;
if (P.use1_13 || isWoodStairs(wood.getType())) {
String material = wood.getType().name();
if (material.startsWith("OAK")) {
woodType = TreeSpecies.GENERIC;
} else if (material.startsWith("SPRUCE")) {
woodType = TreeSpecies.REDWOOD;
} else if (material.startsWith("BIRCH")) {
woodType = TreeSpecies.BIRCH;
} else if (material.startsWith("JUNGLE")) {
woodType = TreeSpecies.JUNGLE;
} else if (material.startsWith("ACACIA")) {
woodType = TreeSpecies.ACACIA;
} else if (material.startsWith("DARK_OAK")) {
woodType = TreeSpecies.DARK_OAK;
} else {
return 0;
}
} else {
MaterialData data = wood.getState().getData();
if (data instanceof Tree) {
woodType = ((Tree) data).getSpecies();
} else if (data instanceof Wood) {
woodType = ((Wood) data).getSpecies();
} else {
return 0;
}
}
switch (woodType) {
case GENERIC:
return 2;
case REDWOOD:
return 4;
case BIRCH:
return 1;
case JUNGLE:
return 3;
case ACACIA:
return 5;
case DARK_OAK:
return 6;
default:
return 0;
}
}
// 0 = empty, 1 = something in, 2 = full
public static byte getFillLevel(Block block) {
if (block.getType() != Material.CAULDRON) {
return 0;
}
if (P.use1_13) {
Levelled cauldron = ((Levelled) block.getBlockData());
if (cauldron.getLevel() == 0) {
return 0;
} else if (cauldron.getLevel() == cauldron.getMaximumLevel()) {
return 2;
} else {
return 1;
}
} else {
Cauldron cauldron = (Cauldron) block.getState().getData();
if (cauldron.isEmpty()) {
return 0;
} else if (cauldron.isFull()) {
return 2;
} else {
return 1;
}
}
}
public static Material getMaterial(int id) {
try {
return GET_MATERIAL != null ? (Material) GET_MATERIAL.invoke(null, id) : null;
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
return null;
}
}
public static int getBlockTypeIdAt(Location location) {
try {
return GET_BLOCK_TYPE_ID_AT != null ? (int) GET_BLOCK_TYPE_ID_AT.invoke(location.getWorld(), location) : 0;
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
return 0;
}
}
// Setting byte data to blocks works in 1.13, but isn't part of the API anymore
public static void setData(Block block, byte data) {
try {
SET_DATA.invoke(block, data);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
}
}
}

View File

@ -3,6 +3,7 @@ package com.dre.brewery;
import com.dre.brewery.filedata.*;
import com.dre.brewery.integration.LogBlockBarrel;
import com.dre.brewery.integration.WGBarrel;
import com.dre.brewery.integration.WGBarrel7;
import com.dre.brewery.integration.WGBarrelNew;
import com.dre.brewery.integration.WGBarrelOld;
import com.dre.brewery.listeners.*;
@ -18,6 +19,7 @@ import java.util.ListIterator;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.lang.math.NumberUtils;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -31,15 +33,17 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
public class P extends JavaPlugin {
public static P p;
public static final String configVersion = "1.5";
public static final String configVersion = "1.6";
public static boolean debug;
public static boolean useUUID;
public static boolean use1_9;
public static boolean use1_12;
public static boolean use1_13;
public static boolean updateCheck;
// Third Party Enabled
@ -73,6 +77,7 @@ public class P extends JavaPlugin {
useUUID = !v.matches("(^|.*[^\\.\\d])1\\.[0-6]([^\\d].*|$)") && !v.matches("(^|.*[^\\.\\d])1\\.7\\.[0-5]([^\\d].*|$)");
use1_9 = !v.matches("(^|.*[^\\.\\d])1\\.[0-8]([^\\d].*|$)");
use1_12 = !v.matches("(^|.*[^\\.\\d])1\\.[0-11]([^\\d].*|$)");
use1_13 = !v.matches("(^|.*[^\\.\\d])1\\.1[0-2]([^\\d].*|$)") && !v.matches("(^|.*[^\\.\\d])1\\.[0-9]([^\\d].*|$)");
// load the Config
try {
@ -90,7 +95,7 @@ public class P extends JavaPlugin {
readData();
// Setup Metrics
setupMetrics();
new Metrics(this);
// Listeners
blockListener = new BlockListener();
@ -155,13 +160,6 @@ public class P extends JavaPlugin {
this.log(this.getDescription().getName() + " disabled!");
}
public void setupMetrics() {
try {
new com.dre.brewery.integration.Metrics(this).start();
} catch (Exception ignored) {
}
}
public void reload(CommandSender sender) {
if (sender != null && !sender.equals(getServer().getConsoleSender())) {
reloader = sender;
@ -264,27 +262,26 @@ public class P extends JavaPlugin {
// Third-Party
useWG = config.getBoolean("useWorldGuard", true) && getServer().getPluginManager().isPluginEnabled("WorldGuard");
if (useWG) {
try {
try {
Class.forName("com.sk89q.worldguard.bukkit.RegionContainer");
wg = new WGBarrelNew();
} catch (ClassNotFoundException e) {
wg = new WGBarrelOld();
}
} catch (Throwable e) {
wg = null;
Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldEdit");
if (plugin != null) {
String wgv = plugin.getDescription().getVersion();
if (wgv.startsWith("7.")) wg = new WGBarrel7();
else if (wgv.startsWith("6.")) wg = new WGBarrelNew();
else if (wgv.startsWith("5.")) wg = new WGBarrelOld();
}
if (wg == null) {
P.p.errorLog("Failed loading WorldGuard Integration! Opening Barrels will NOT work!");
P.p.errorLog("Brewery was tested with version 5.8 to 6.1 of WorldGuard!");
P.p.errorLog("Brewery was tested with version 5.8, 6.1 and 7.0 of WorldGuard!");
P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload");
e.printStackTrace();
}
}
useLWC = config.getBoolean("useLWC", true) && getServer().getPluginManager().isPluginEnabled("LWC");
useGP = config.getBoolean("useGriefPrevention", true) && getServer().getPluginManager().isPluginEnabled("GriefPrevention");
useLB = config.getBoolean("useLogBlock", false) && getServer().getPluginManager().isPluginEnabled("LogBlock");
hasVault = getServer().getPluginManager().isPluginEnabled("Vault");
useCitadel = config.getBoolean("useCitadel", false) && getServer().getPluginManager().isPluginEnabled("Citadel");
// The item util has been removed in Vault 1.7+
hasVault = getServer().getPluginManager().isPluginEnabled("Vault")
&& Integer.parseInt(getServer().getPluginManager().getPlugin("Vault").getDescription().getVersion().split("\\.")[1]) <= 6;
// various Settings
DataSave.autosave = config.getInt("autosave", 3);
@ -609,7 +606,7 @@ public class P extends JavaPlugin {
if (!cfg.exists()) {
errorLog("No config.yml found, creating default file! You may want to choose a config according to your language!");
errorLog("You can find them in plugins/Brewery/configs/");
InputStream defconf = getResource("config/en/config.yml");
InputStream defconf = getResource("config/" + (use1_13 ? "v13/" : "v12/") + "en/config.yml");
if (defconf == null) {
errorLog("default config file not found, your jarfile may be corrupt. Disabling Brewery!");
return false;
@ -636,7 +633,7 @@ public class P extends JavaPlugin {
for (String l : new String[] {"de", "en", "fr", "it"}) {
File lfold = new File(configs, l);
try {
saveFile(getResource("config/" + l + "/config.yml"), lfold, "config.yml", overwrite);
saveFile(getResource("config/" + (use1_13 ? "v13/" : "v12/") + l + "/config.yml"), lfold, "config.yml", overwrite);
saveFile(getResource("languages/" + l + ".yml"), languages, l + ".yml", false); // Never overwrite languages for now
} catch (IOException e) {
e.printStackTrace();
@ -700,19 +697,13 @@ public class P extends JavaPlugin {
// Returns true if the Block can be destroyed by the Player or something else (null)
public boolean blockDestroy(Block block, Player player) {
switch (block.getType()) {
case CAULDRON:
Material type = block.getType();
if (type == Material.CAULDRON) {
// will only remove when existing
BCauldron.remove(block);
return true;
case FENCE:
case NETHER_FENCE:
case ACACIA_FENCE:
case BIRCH_FENCE:
case DARK_OAK_FENCE:
case IRON_FENCE:
case JUNGLE_FENCE:
case SPRUCE_FENCE:
} else if (LegacyUtil.isFence(type)) {
// remove barrel and throw potions on the ground
Barrel barrel = Barrel.getBySpigot(block);
if (barrel != null) {
@ -724,8 +715,8 @@ public class P extends JavaPlugin {
}
}
return true;
case SIGN_POST:
case WALL_SIGN:
} else if (LegacyUtil.isSign(type)) {
// remove small Barrels
Barrel barrel2 = Barrel.getBySpigot(block);
if (barrel2 != null) {
@ -741,13 +732,8 @@ public class P extends JavaPlugin {
}
}
return true;
case WOOD:
case WOOD_STAIRS:
case BIRCH_WOOD_STAIRS:
case JUNGLE_WOOD_STAIRS:
case SPRUCE_WOOD_STAIRS:
case ACACIA_STAIRS:
case DARK_OAK_STAIRS:
} else if (LegacyUtil.isWoodPlanks(type) || LegacyUtil.isWoodStairs(type)){
Barrel barrel3 = Barrel.getByWood(block);
if (barrel3 != null) {
if (barrel3.hasPermsDestroy(player)) {
@ -756,9 +742,7 @@ public class P extends JavaPlugin {
return false;
}
}
default:
break;
}
}
return true;
}

View File

@ -144,7 +144,11 @@ public class ConfigUpdater {
fromVersion = "1.5";
}
if (!fromVersion.equals("1.5")) {
if (fromVersion.equals("1.5")) {
fromVersion = "1.6";
}
if (!fromVersion.equals("1.6")) {
P.p.log(P.p.languageReader.get("Error_ConfigUpdate", fromVersion));
return;
}

View File

@ -1,106 +1,107 @@
package com.dre.brewery.filedata;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import com.dre.brewery.P;
public class DataUpdater {
private FileConfiguration data;
private File file;
public DataUpdater(FileConfiguration data, File file) {
this.data = data;
this.file = file;
}
public void update(String fromVersion) {
if (fromVersion.equalsIgnoreCase("1.0")) {
update10();
//fromVersion = "1.1";
}
try {
data.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}
@SuppressWarnings("deprecation")
public void update10() {
data.set("Version", DataSave.dataVersion);
ConfigurationSection section = data.getConfigurationSection("Ingredients");
try {
if (section != null) {
for (String id : section.getKeys(false)) {
ConfigurationSection matSection = section.getConfigurationSection(id + ".mats");
if (matSection != null) {
// matSection has all the materials + amount as Integers
Map<String, Integer> ingredients = new HashMap<>();
for (String ingredient : matSection.getKeys(false)) {
// convert to Material
Material mat = Material.getMaterial(P.p.parseInt(ingredient));
if (mat != null) {
ingredients.put(mat.name(), matSection.getInt(ingredient));
}
}
section.set(id + ".mats", ingredients);
} else {
P.p.errorLog("Ingredient id: '" + id + "' incomplete in data.yml");
}
}
}
} catch (Exception e) {
// Getting Material by id may not work in the future
P.p.errorLog("Error Converting Ingredient Section of the Data File, newer versions of Bukkit may not support the old Save File anymore:");
e.printStackTrace();
}
section = data.getConfigurationSection("BCauldron");
if (section != null) {
try {
for (String uuid : section.getKeys(false)) {
ConfigurationSection cauldrons = section.getConfigurationSection(uuid);
if (cauldrons != null) {
for (String id : cauldrons.getKeys(false)) {
ConfigurationSection ingredientSection = cauldrons.getConfigurationSection(id + ".ingredients");
if (ingredientSection != null) {
// has all the materials + amount as Integers
Map<String, Integer> ingredients = new HashMap<>();
for (String ingredient : ingredientSection.getKeys(false)) {
// convert to Material
Material mat = Material.getMaterial(P.p.parseInt(ingredient));
if (mat != null) {
ingredients.put(mat.name(), ingredientSection.getInt(ingredient));
}
}
cauldrons.set(id + ".ingredients", ingredients);
} else {
P.p.errorLog("BCauldron " + id + " is missing Ingredient Section");
}
}
}
}
} catch (Exception e) {
// Getting Material by id may not work in the future
P.p.errorLog("Error Converting Ingredient Section of Cauldrons, newer versions of Bukkit may not support the old Save File anymore:");
e.printStackTrace();
}
}
}
}
package com.dre.brewery.filedata;
import com.dre.brewery.LegacyUtil;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import com.dre.brewery.P;
public class DataUpdater {
private FileConfiguration data;
private File file;
public DataUpdater(FileConfiguration data, File file) {
this.data = data;
this.file = file;
}
public void update(String fromVersion) {
if (fromVersion.equalsIgnoreCase("1.0")) {
update10();
//fromVersion = "1.1";
}
try {
data.save(file);
} catch (IOException e) {
e.printStackTrace();
}
}
@SuppressWarnings("deprecation")
public void update10() {
data.set("Version", DataSave.dataVersion);
ConfigurationSection section = data.getConfigurationSection("Ingredients");
try {
if (section != null) {
for (String id : section.getKeys(false)) {
ConfigurationSection matSection = section.getConfigurationSection(id + ".mats");
if (matSection != null) {
// matSection has all the materials + amount as Integers
Map<String, Integer> ingredients = new HashMap<>();
for (String ingredient : matSection.getKeys(false)) {
// convert to Material
Material mat = LegacyUtil.getMaterial(P.p.parseInt(ingredient));
if (mat != null) {
ingredients.put(mat.name(), matSection.getInt(ingredient));
}
}
section.set(id + ".mats", ingredients);
} else {
P.p.errorLog("Ingredient id: '" + id + "' incomplete in data.yml");
}
}
}
} catch (Exception e) {
// Getting Material by id may not work in the future
P.p.errorLog("Error Converting Ingredient Section of the Data File, newer versions of Bukkit may not support the old Save File anymore:");
e.printStackTrace();
}
section = data.getConfigurationSection("BCauldron");
if (section != null) {
try {
for (String uuid : section.getKeys(false)) {
ConfigurationSection cauldrons = section.getConfigurationSection(uuid);
if (cauldrons != null) {
for (String id : cauldrons.getKeys(false)) {
ConfigurationSection ingredientSection = cauldrons.getConfigurationSection(id + ".ingredients");
if (ingredientSection != null) {
// has all the materials + amount as Integers
Map<String, Integer> ingredients = new HashMap<>();
for (String ingredient : ingredientSection.getKeys(false)) {
// convert to Material
Material mat = LegacyUtil.getMaterial(P.p.parseInt(ingredient));
if (mat != null) {
ingredients.put(mat.name(), ingredientSection.getInt(ingredient));
}
}
cauldrons.set(id + ".ingredients", ingredients);
} else {
P.p.errorLog("BCauldron " + id + " is missing Ingredient Section");
}
}
}
}
} catch (Exception e) {
// Getting Material by id may not work in the future
P.p.errorLog("Error Converting Ingredient Section of Cauldrons, newer versions of Bukkit may not support the old Save File anymore:");
e.printStackTrace();
}
}
}
}

View File

@ -1,81 +1,119 @@
package com.dre.brewery.integration;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import de.diddiz.LogBlock.Consumer;
import de.diddiz.LogBlock.LogBlock;
import de.diddiz.LogBlock.Logging;
import static de.diddiz.LogBlock.config.Config.isLogging;
import static de.diddiz.util.BukkitUtils.compareInventories;
import static de.diddiz.util.BukkitUtils.compressInventory;
import static de.diddiz.util.BukkitUtils.rawData;
public class LogBlockBarrel {
private static final List<LogBlockBarrel> opened = new ArrayList<>();
public static Consumer consumer = LogBlock.getInstance().getConsumer();
private HumanEntity player;
private ItemStack[] items;
private Location loc;
public LogBlockBarrel(HumanEntity player, ItemStack[] items, Location spigotLoc) {
this.player = player;
this.items = items;
this.loc = spigotLoc;
opened.add(this);
}
private void compareInv(final ItemStack[] after) {
if (consumer == null) {
return;
}
final ItemStack[] diff = compareInventories(items, after);
for (final ItemStack item : diff) {
consumer.queueChestAccess(player.getName(), loc, loc.getWorld().getBlockTypeIdAt(loc), (short) item.getTypeId(), (short) item.getAmount(), rawData(item));
}
}
public static LogBlockBarrel get(HumanEntity player) {
for (LogBlockBarrel open : opened) {
if (open.player.equals(player)) {
return open;
}
}
return null;
}
public static void openBarrel(HumanEntity player, Inventory inv, Location spigotLoc) {
if (!isLogging(player.getWorld(), Logging.CHESTACCESS)) return;
new LogBlockBarrel(player, compressInventory(inv.getContents()), spigotLoc);
}
public static void closeBarrel(HumanEntity player, Inventory inv) {
if (!isLogging(player.getWorld(), Logging.CHESTACCESS)) return;
LogBlockBarrel open = get(player);
if (open != null) {
open.compareInv(compressInventory(inv.getContents()));
opened.remove(open);
}
}
public static void breakBarrel(String playerName, ItemStack[] contents, Location spigotLoc) {
if (consumer == null) {
return;
}
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
final ItemStack[] items = compressInventory(contents);
for (final ItemStack item : items) {
consumer.queueChestAccess(playerName, spigotLoc, spigotLoc.getWorld().getBlockTypeIdAt(spigotLoc), (short) item.getTypeId(), (short) (item.getAmount() * -1), rawData(item));
}
}
public static void clear() {
opened.clear();
}
}
package com.dre.brewery.integration;
import com.dre.brewery.LegacyUtil;
import com.dre.brewery.P;
import de.diddiz.LogBlock.Actor;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import de.diddiz.LogBlock.Consumer;
import de.diddiz.LogBlock.LogBlock;
import de.diddiz.LogBlock.Logging;
import static de.diddiz.LogBlock.config.Config.isLogging;
import de.diddiz.util.BukkitUtils;
import static de.diddiz.util.BukkitUtils.compareInventories;
import static de.diddiz.util.BukkitUtils.compressInventory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class LogBlockBarrel {
private static final List<LogBlockBarrel> opened = new ArrayList<>();
public static Consumer consumer = LogBlock.getInstance().getConsumer();
private static Method rawData;
private static Method queueChestAccess;
static {
if (!P.use1_13) {
try {
rawData = BukkitUtils.class.getDeclaredMethod("rawData", ItemStack.class);
queueChestAccess = Consumer.class.getDeclaredMethod("queueChestAccess", String.class, Location.class, int.class, short.class, short.class, short.class);
} catch (NoSuchMethodException e) {
P.p.errorLog("Failed to hook into LogBlock to log barrels. Logging barrel contents is not going to work.");
P.p.errorLog("Brewery was tested with version 1.12 to 1.13.1 of LogBlock.");
P.p.errorLog("Disable LogBlock support in the configuration file and type /brew reload.");
e.printStackTrace();
}
}
}
private HumanEntity player;
private ItemStack[] items;
private Location loc;
public LogBlockBarrel(HumanEntity player, ItemStack[] items, Location spigotLoc) {
this.player = player;
this.items = items;
this.loc = spigotLoc;
opened.add(this);
}
private void compareInv(final ItemStack[] after) {
if (consumer == null) {
return;
}
final ItemStack[] diff = compareInventories(items, after);
for (final ItemStack item : diff) {
if (!P.use1_13) {
try {
queueChestAccess.invoke(consumer, player.getName(), loc, LegacyUtil.getBlockTypeIdAt(loc), (short) item.getType().getId(), (short) item.getAmount(), (short) rawData.invoke(null, item));
} catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
}
} else {
consumer.queueChestAccess(Actor.actorFromEntity(player), loc, loc.getBlock().getBlockData(), item, false);
}
}
}
public static LogBlockBarrel get(HumanEntity player) {
for (LogBlockBarrel open : opened) {
if (open.player.equals(player)) {
return open;
}
}
return null;
}
public static void openBarrel(HumanEntity player, Inventory inv, Location spigotLoc) {
if (!isLogging(player.getWorld(), Logging.CHESTACCESS)) return;
new LogBlockBarrel(player, compressInventory(inv.getContents()), spigotLoc);
}
public static void closeBarrel(HumanEntity player, Inventory inv) {
if (!isLogging(player.getWorld(), Logging.CHESTACCESS)) return;
LogBlockBarrel open = get(player);
if (open != null) {
open.compareInv(compressInventory(inv.getContents()));
opened.remove(open);
}
}
public static void breakBarrel(String playerName, ItemStack[] contents, Location spigotLoc) {
if (consumer == null) {
return;
}
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
final ItemStack[] items = compressInventory(contents);
for (final ItemStack item : items) {
if (!P.use1_13) {
try {
queueChestAccess.invoke(consumer, playerName, spigotLoc, LegacyUtil.getBlockTypeIdAt(spigotLoc), (short) item.getType().getId(), (short) (item.getAmount() * -1), rawData.invoke(null, item));
} catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
}
} else {
consumer.queueChestAccess(Actor.actorFromString(playerName), spigotLoc, spigotLoc.getBlock().getBlockData(), item, false);
}
}
}
public static void clear() {
opened.clear();
}
}

View File

@ -1,758 +0,0 @@
package com.dre.brewery.integration;
/*
* Copyright 2011-2013 Tyler Blair. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and contributors and should not be interpreted as representing official policies,
* either expressed or implied, of anybody else.
*/
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;
public class Metrics {
/**
* The current revision number
*/
private final static int REVISION = 7;
/**
* The base url of the metrics domain
*/
private static final String BASE_URL = "http://report.mcstats.org";
/**
* The url used to report a server's status
*/
private static final String REPORT_URL = "/plugin/%s";
/**
* Interval of time to ping (in minutes)
*/
private static final int PING_INTERVAL = 15;
/**
* The plugin this metrics submits for
*/
private final Plugin plugin;
/**
* All of the custom graphs to submit to metrics
*/
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
/**
* The plugin configuration file
*/
private final YamlConfiguration configuration;
/**
* The plugin configuration file
*/
private final File configurationFile;
/**
* Unique server id
*/
private final String guid;
/**
* Debug mode
*/
private final boolean debug;
/**
* Lock for synchronization
*/
private final Object optOutLock = new Object();
/**
* The scheduled task
*/
private volatile BukkitTask task = null;
public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.loadConfiguration(configurationFile);
// add some defaults
configuration.addDefault("opt-out", false);
configuration.addDefault("guid", UUID.randomUUID().toString());
configuration.addDefault("debug", false);
// Do we need to create the file?
if (configuration.get("guid", null) == null) {
configuration.options().header("http://mcstats.org").copyDefaults(true);
configuration.save(configurationFile);
}
// Load the guid then
guid = configuration.getString("guid");
debug = configuration.getBoolean("debug", false);
}
/**
* Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics
* website. Plotters can be added to the graph object returned.
*
* @param name The name of the graph
* @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
*/
public Graph createGraph(final String name) {
if (name == null) {
throw new IllegalArgumentException("Graph name cannot be null");
}
// Construct the graph object
final Graph graph = new Graph(name);
// Now we can add our graph
graphs.add(graph);
// and return back
return graph;
}
/**
* Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend
*
* @param graph The name of the graph
*/
public void addGraph(final Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph cannot be null");
}
graphs.add(graph);
}
/**
* Start measuring statistics. This will immediately create an async repeating task as the plugin and send the
* initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200
* ticks.
*
* @return True if statistics measuring is running, otherwise false.
*/
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the server with glorious data
task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
private boolean firstPost = true;
public void run() {
try {
// This has to be synchronized or it can collide with the disable method.
synchronized (optOutLock) {
// Disable Task, if it is running and the server owner decided to opt-out
if (isOptOut() && task != null) {
task.cancel();
task = null;
// Tell all plotters to stop gathering information.
for (Graph graph : graphs) {
graph.onOptOut();
}
}
}
// We use the inverse of firstPost because if it is the first time we are posting,
// it is not a interval ping, so it evaluates to FALSE
// Each time thereafter it will evaluate to TRUE, i.e PING!
postPlugin(!firstPost);
// After the first post we set firstPost to false
// Each post thereafter will be a ping
firstPost = false;
} catch (IOException e) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
}
}
}
}, 0, PING_INTERVAL * 1200);
return true;
}
}
/**
* Has the server owner denied plugin metrics?
*
* @return true if metrics should be opted out of it
*/
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
} catch (InvalidConfigurationException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
}
return configuration.getBoolean("opt-out", false);
}
}
/**
* Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
*
* @throws java.io.IOException
*/
public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.set("opt-out", false);
configuration.save(configurationFile);
}
// Enable Task, if it is not running
if (task == null) {
start();
}
}
}
/**
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
*
* @throws java.io.IOException
*/
public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (!isOptOut()) {
configuration.set("opt-out", true);
configuration.save(configurationFile);
}
// Disable Task, if it is running
if (task != null) {
task.cancel();
task = null;
}
}
}
/**
* Gets the File object of the config file that should be used to store data such as the GUID and opt-out status
*
* @return the File object for the config file
*/
public File getConfigFile() {
// I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
// is to abuse the plugin object we already have
// plugin.getDataFolder() => base/plugins/PluginA/
// pluginsFolder => base/plugins/
// The base is not necessarily relative to the startup directory.
File pluginsFolder = plugin.getDataFolder().getParentFile();
// return => base/plugins/PluginMetrics/config.yml
return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
}
/**
* Generic method that posts a plugin to the metrics website
*/
private void postPlugin(final boolean isPing) throws IOException {
// Server software specific section
PluginDescriptionFile description = plugin.getDescription();
String pluginName = description.getName();
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
String pluginVersion = description.getVersion();
String serverVersion = Bukkit.getVersion();
int playersOnline = Bukkit.getServer().getOnlinePlayers().size();
// END server software specific section -- all code below does not use any code outside of this class / Java
// Construct the post data
StringBuilder json = new StringBuilder(1024);
json.append('{');
// The plugin's description file containg all of the plugin data such as name, version, author, etc
appendJSONPair(json, "guid", guid);
appendJSONPair(json, "plugin_version", pluginVersion);
appendJSONPair(json, "server_version", serverVersion);
appendJSONPair(json, "players_online", Integer.toString(playersOnline));
// New data as of R6
String osname = System.getProperty("os.name");
String osarch = System.getProperty("os.arch");
String osversion = System.getProperty("os.version");
String java_version = System.getProperty("java.version");
int coreCount = Runtime.getRuntime().availableProcessors();
// normalize os arch .. amd64 -> x86_64
if (osarch.equals("amd64")) {
osarch = "x86_64";
}
appendJSONPair(json, "osname", osname);
appendJSONPair(json, "osarch", osarch);
appendJSONPair(json, "osversion", osversion);
appendJSONPair(json, "cores", Integer.toString(coreCount));
appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
appendJSONPair(json, "java_version", java_version);
// If we're pinging, append it
if (isPing) {
appendJSONPair(json, "ping", "1");
}
if (graphs.size() > 0) {
synchronized (graphs) {
json.append(',');
json.append('"');
json.append("graphs");
json.append('"');
json.append(':');
json.append('{');
boolean firstGraph = true;
final Iterator<Graph> iter = graphs.iterator();
while (iter.hasNext()) {
Graph graph = iter.next();
StringBuilder graphJson = new StringBuilder();
graphJson.append('{');
for (Plotter plotter : graph.getPlotters()) {
appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
}
graphJson.append('}');
if (!firstGraph) {
json.append(',');
}
json.append(escapeJSON(graph.getName()));
json.append(':');
json.append(graphJson);
firstGraph = false;
}
json.append('}');
}
}
// close json
json.append('}');
// Create the url
URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
// Connect to the website
URLConnection connection;
// Mineshafter creates a socks proxy, so we can safely bypass it
// It does not reroute POST requests so we need to go around it
if (isMineshafterPresent()) {
connection = url.openConnection(Proxy.NO_PROXY);
} else {
connection = url.openConnection();
}
byte[] uncompressed = json.toString().getBytes();
byte[] compressed = gzip(json.toString());
// Headers
connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
connection.addRequestProperty("Content-Type", "application/json");
connection.addRequestProperty("Content-Encoding", "gzip");
connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
connection.addRequestProperty("Accept", "application/json");
connection.addRequestProperty("Connection", "close");
connection.setDoOutput(true);
if (debug) {
System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
}
// Write the data
OutputStream os = connection.getOutputStream();
os.write(compressed);
os.flush();
// Now read the response
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String response = reader.readLine();
// close resources
os.close();
reader.close();
if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
if (response == null) {
response = "null";
} else if (response.startsWith("7")) {
response = response.substring(response.startsWith("7,") ? 2 : 1);
}
throw new IOException(response);
} else {
// Is this the first update this hour?
if (response.equals("1") || response.contains("This is your first update this hour")) {
synchronized (graphs) {
final Iterator<Graph> iter = graphs.iterator();
while (iter.hasNext()) {
final Graph graph = iter.next();
for (Plotter plotter : graph.getPlotters()) {
plotter.reset();
}
}
}
}
}
}
/**
* GZip compress a string of bytes
*
* @param input
* @return
*/
public static byte[] gzip(String input) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = null;
try {
gzos = new GZIPOutputStream(baos);
gzos.write(input.getBytes("UTF-8"));
} catch (IOException e) {
e.printStackTrace();
} finally {
if (gzos != null) try {
gzos.close();
} catch (IOException ignore) {
}
}
return baos.toByteArray();
}
/**
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests
*
* @return true if mineshafter is installed on the server
*/
private boolean isMineshafterPresent() {
try {
Class.forName("mineshafter.MineServer");
return true;
} catch (Exception e) {
return false;
}
}
/**
* Appends a json encoded key/value pair to the given string builder.
*
* @param json
* @param key
* @param value
* @throws UnsupportedEncodingException
*/
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric;
try {
Double.parseDouble(value);
isValueNumeric = true;
} catch (NumberFormatException e) {
isValueNumeric = false;
}
if (json.charAt(json.length() - 1) != '{') {
json.append(',');
}
json.append(escapeJSON(key));
json.append(':');
if (isValueNumeric) {
json.append(value);
} else {
json.append(escapeJSON(value));
}
}
/**
* Escape a string to create a valid JSON string
*
* @param text
* @return
*/
private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
builder.append('\\');
builder.append(chr);
break;
case '\b':
builder.append("\\b");
break;
case '\t':
builder.append("\\t");
break;
case '\n':
builder.append("\\n");
break;
case '\r':
builder.append("\\r");
break;
default:
if (chr < ' ') {
String t = "000" + Integer.toHexString(chr);
builder.append("\\u" + t.substring(t.length() - 4));
} else {
builder.append(chr);
}
break;
}
}
builder.append('"');
return builder.toString();
}
/**
* Encode text as UTF-8
*
* @param text the text to encode
* @return the encoded text, as UTF-8
*/
private static String urlEncode(final String text) throws UnsupportedEncodingException {
return URLEncoder.encode(text, "UTF-8");
}
/**
* Represents a custom graph on the website
*/
public static class Graph {
/**
* The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is
* rejected
*/
private final String name;
/**
* The set of plotters that are contained within this graph
*/
private final Set<Plotter> plotters = new LinkedHashSet<Plotter>();
private Graph(final String name) {
this.name = name;
}
/**
* Gets the graph's name
*
* @return the Graph's name
*/
public String getName() {
return name;
}
/**
* Add a plotter to the graph, which will be used to plot entries
*
* @param plotter the plotter to add to the graph
*/
public void addPlotter(final Plotter plotter) {
plotters.add(plotter);
}
/**
* Remove a plotter from the graph
*
* @param plotter the plotter to remove from the graph
*/
public void removePlotter(final Plotter plotter) {
plotters.remove(plotter);
}
/**
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
*
* @return an unmodifiable {@link java.util.Set} of the plotter objects
*/
public Set<Plotter> getPlotters() {
return Collections.unmodifiableSet(plotters);
}
@Override
public int hashCode() {
return name.hashCode();
}
@Override
public boolean equals(final Object object) {
if (!(object instanceof Graph)) {
return false;
}
final Graph graph = (Graph) object;
return graph.name.equals(name);
}
/**
* Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
*/
protected void onOptOut() {
}
}
/**
* Interface used to collect custom data for a plugin
*/
public static abstract class Plotter {
/**
* The plot's name
*/
private final String name;
/**
* Construct a plotter with the default plot name
*/
public Plotter() {
this("Default");
}
/**
* Construct a plotter with a specific plot name
*
* @param name the name of the plotter to use, which will show up on the website
*/
public Plotter(final String name) {
this.name = name;
}
/**
* Get the current value for the plotted point. Since this function defers to an external function it may or may
* not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called
* from any thread so care should be taken when accessing resources that need to be synchronized.
*
* @return the current value for the point to be plotted.
*/
public abstract int getValue();
/**
* Get the column name for the plotted point
*
* @return the plotted point's column name
*/
public String getColumnName() {
return name;
}
/**
* Called after the website graphs have been updated
*/
public void reset() {
}
@Override
public int hashCode() {
return getColumnName().hashCode();
}
@Override
public boolean equals(final Object object) {
if (!(object instanceof Plotter)) {
return false;
}
final Plotter plotter = (Plotter) object;
return plotter.name.equals(name) && plotter.getValue() == getValue();
}
}
}

View File

@ -0,0 +1,42 @@
package com.dre.brewery.integration;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import com.dre.brewery.P;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.internal.permission.RegionPermissionModel;
import com.sk89q.worldguard.internal.platform.WorldGuardPlatform;
import com.sk89q.worldguard.protection.flags.Flags;
import com.sk89q.worldguard.protection.regions.RegionQuery;
public class WGBarrel7 implements WGBarrel {
public boolean checkAccess(Player player, Block spigot, Plugin plugin) {
WorldGuardPlugin wg = (WorldGuardPlugin) plugin;
WorldGuardPlatform platform = WorldGuard.getInstance().getPlatform();
World world = platform.getWorldByName(spigot.getWorld().getName());
if (!platform.getGlobalStateManager().get(world).useRegions) return true; // Region support disabled
WorldEditPlugin we = JavaPlugin.getPlugin(WorldEditPlugin.class);
if (new RegionPermissionModel((Actor) we.wrapPlayer(player)).mayIgnoreRegionProtection(world)) return true; // Whitelisted cause
RegionQuery query = platform.getRegionContainer().createQuery();
if (!query.testBuild(new Location(world, spigot.getX(), spigot.getY(), spigot.getZ()), wg.wrapPlayer(player), Flags.USE, Flags.CHEST_ACCESS)) {
P.p.msg(player, P.p.languageReader.get("Error_NoBarrelAccess"));
return false;
}
return true;
}
}

View File

@ -42,7 +42,7 @@ public class PlayerListener implements Listener {
if (materialInHand == null || materialInHand == Material.BUCKET) {
return;
} else if (materialInHand == Material.WATCH) {
} else if (materialInHand == LegacyUtil.CLOCK) {
BCauldron.printTime(player, clickedBlock);
return;
@ -67,18 +67,17 @@ public class PlayerListener implements Listener {
// reset cauldron when refilling to prevent unlimited source of potions
} else if (materialInHand == Material.WATER_BUCKET) {
if (!P.use1_9) {
if (BCauldron.getFillLevel(clickedBlock) != 0 && BCauldron.getFillLevel(clickedBlock) < 2) {
if (LegacyUtil.getFillLevel(clickedBlock) == 1) {
// will only remove when existing
BCauldron.remove(clickedBlock);
}
}
return;
}
// Check if fire alive below cauldron when adding ingredients
Block down = clickedBlock.getRelative(BlockFace.DOWN);
if (down.getType() == Material.FIRE || down.getType() == Material.STATIONARY_LAVA || down.getType() == Material.LAVA) {
if (down.getType() == Material.FIRE || LegacyUtil.isLava(down.getType())) {
event.setCancelled(true);
boolean handSwap = false;
@ -147,11 +146,11 @@ public class PlayerListener implements Listener {
// Access a Barrel
Barrel barrel = null;
if (type == Material.WOOD) {
if (LegacyUtil.isWoodPlanks(type)) {
if (openEverywhere) {
barrel = Barrel.get(clickedBlock);
}
} else if (Barrel.isStairs(type)) {
} else if (LegacyUtil.isWoodStairs(type)) {
for (Barrel barrel2 : Barrel.barrels) {
if (barrel2.hasStairsBlock(clickedBlock)) {
if (openEverywhere || !barrel2.isLarge()) {
@ -160,7 +159,7 @@ public class PlayerListener implements Listener {
break;
}
}
} else if (Barrel.isFence(type) || type == Material.SIGN_POST || type == Material.WALL_SIGN) {
} else if (LegacyUtil.isFence(type) || LegacyUtil.isSign(type)) {
barrel = Barrel.getBySpigot(clickedBlock);
}