Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BreweryX (v3.3.6+) Support #430

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b681351
working on it
Jsinco Feb 29, 2024
7820362
working on it
Jsinco Apr 29, 2024
fceacdb
laptop push
Jsinco May 5, 2024
dadac47
should be ready for pull
Jsinco Jun 6, 2024
b89a1d8
Merge remote-tracking branch 'origin/master'
Jsinco Jun 6, 2024
92b1f86
BreweryX support
Jsinco Jun 6, 2024
ab820b4
laptop push
Jsinco Jun 7, 2024
09bc856
code fixes
Jsinco Jun 7, 2024
3e3b437
rename classes
Jsinco Jun 7, 2024
89399ef
add BreweryX dependency
Jsinco Jun 7, 2024
477394b
add BreweryX dependency
Jsinco Jun 7, 2024
1814caa
fix review issues
Jsinco Jun 7, 2024
529119c
turn bplayer obj to extension
Jsinco Jun 7, 2024
4c78d7f
Merge branch 'master' of https://github.com/Jsinco/Depenizen
Jsinco Jun 7, 2024
e1cfe5e
Merge branch 'master' of https://github.com/Jsinco/Depenizen
Jsinco Jun 7, 2024
8d1993d
Merge branch 'master' of https://github.com/Jsinco/Depenizen
Jsinco Jun 7, 2024
45d41d0
review changes
Jsinco Jun 8, 2024
9862906
review changes
Jsinco Jun 8, 2024
cdaf64f
stray newline
Jsinco Jun 9, 2024
68644f0
register tagProcessor with object init
Jsinco Jun 9, 2024
827ed9b
Merge branch 'DenizenScript:master' into master
Jsinco Jul 10, 2024
0e573d7
Merge branch 'DenizenScript:master' into master
Jsinco Aug 24, 2024
ba65850
Merge branch 'DenizenScript:master' into master
Jsinco Nov 22, 2024
49b681d
Update BreweryX dependency, fix a couple of things after Aya's review.
Jsinco Nov 22, 2024
e96c8c4
fix identifier, get names based on quality. Add is_valid, has_glint, …
Jsinco Nov 23, 2024
2e87411
remove double stray parenthesis
Jsinco Dec 5, 2024
877bd48
Merge branch 'DenizenScript:master' into master
Jsinco Dec 9, 2024
2dfb00a
change wood comment and include BreweryX in BukkitPlugins.md
Jsinco Dec 10, 2024
740d367
Merge remote-tracking branch 'origin/master'
Jsinco Dec 10, 2024
a659be6
Merge branch 'DenizenScript:master' into master
Jsinco Dec 10, 2024
9254240
change where BRecipeTag is created
Jsinco Dec 10, 2024
cf57064
oops, left an extra ';'
Jsinco Dec 10, 2024
ed22938
change comment on this event
Jsinco Dec 10, 2024
5f92726
add type context comment to BrewModifyEvent
Jsinco Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Docs/BukkitPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Supported Plugins: (And the sources we acquired Jar files from.)
- BetonQuest (https://www.spigotmc.org/resources/betonquest.2117/)
- BigDoors (https://www.spigotmc.org/resources/big-doors.58669)
- BossShopPro (https://www.spigotmc.org/resources/bossshop.222/)
- BreweryX (https://www.spigotmc.org/resources/breweryx.114777/)
- CoreProtect (https://www.spigotmc.org/resources/coreprotect.8631/)
- CrackShot (https://www.spigotmc.org/resources/crackshot-guns.48301/)
- EffectLib (https://dev.bukkit.org/projects/effectlib)
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,14 @@
<scope>system</scope>
<systemPath>${basedir}/lib/BigDoors.jar</systemPath>
</dependency>
<dependency>
<groupId>com.dre.brewery</groupId>
<artifactId>BreweryX</artifactId>
<version>3.4.3-SNAPSHOT</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${basedir}/lib/BreweryX.jar</systemPath>
</dependency>
</dependencies>

<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public void registerCoreBridges() {
registerBridge("BetonQuest", () -> new BetonQuestBridge());
registerBridge("BigDoors", () -> new BigDoorsBridge());
registerBridge("BossShopPro", () -> new BossShopBridge());
registerBridge("BreweryX", () -> new BreweryXBridge());
registerBridge("CoreProtect", () -> new CoreProtectBridge());
registerBridge("CrackShot", () -> new CrackShotBridge());
registerBridge("EffectLib", () -> new EffectLibBridge());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.denizenscript.depenizen.bukkit.bridges;

import com.denizenscript.denizencore.events.ScriptEvent;
import com.denizenscript.denizencore.objects.ObjectFetcher;
import com.denizenscript.depenizen.bukkit.Bridge;
import com.denizenscript.depenizen.bukkit.events.breweryx.BreweryChatDistortScriptEvent;
import com.denizenscript.depenizen.bukkit.events.breweryx.BreweryDrinkScriptEvent;
import com.denizenscript.depenizen.bukkit.events.breweryx.BreweryIngredientAddScriptEvent;
import com.denizenscript.depenizen.bukkit.events.breweryx.BreweryModifyBrewScriptEvent;
import com.denizenscript.depenizen.bukkit.objects.breweryx.BreweryRecipeTag;
import com.denizenscript.depenizen.bukkit.properties.breweryx.BreweryPlayerExtensions;

public class BreweryXBridge extends Bridge {
@Override
public void init() {
ScriptEvent.registerScriptEvent(BreweryDrinkScriptEvent.class);
ScriptEvent.registerScriptEvent(BreweryModifyBrewScriptEvent.class);
ScriptEvent.registerScriptEvent(BreweryIngredientAddScriptEvent.class);
ScriptEvent.registerScriptEvent(BreweryChatDistortScriptEvent.class);
ObjectFetcher.registerWithObjectFetcher(BreweryRecipeTag.class, BreweryRecipeTag.tagProcessor);
BreweryPlayerExtensions.register();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.denizenscript.depenizen.bukkit.events.breweryx;

import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.dre.brewery.api.events.PlayerChatDistortEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class BreweryChatDistortScriptEvent extends BukkitScriptEvent implements Listener {

// <--[event]
// @Events
// brewery chat distort
//
// @Cancellable true
//
// @Triggers when a drunk brewery player's chat is distorted.
//
// @Context
// <context.message> Returns the message to be sent after being distorted.
// <context.original_message> Returns the original message before being distorted.
// <context.player> Returns a PlayerTag of the player that had their chat distorted.
//
// @Determine
// ElementTag to set the message to be sent after being distorted.
//
// @Plugin Depenizen, BreweryX
//
// @Player Always.
//
// @Group Depenizen
//
// -->
public BreweryChatDistortScriptEvent() {
registerCouldMatcher("brewery chat distort");
}

public PlayerChatDistortEvent event;
public PlayerTag playerTag;

@Override
public boolean matches(ScriptPath path) {
return super.matches(path);
}

@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(event.getPlayer());
}

@Override
public ObjectTag getContext(String name) {
return switch (name) {
case "message" -> new ElementTag(event.getDistortedMessage());
case "original_message" -> new ElementTag(event.getWrittenMessage());
case "player" -> playerTag;
default -> super.getContext(name);
};
}

@Override
public boolean handleDetermination(ScriptPath path, String prefix, ObjectTag value) {
if (prefix.equals("message")) {
event.setDistortedMessage(value.asElement().asString());
return true;
}
return super.handleDetermination(path, prefix, value);
}

@EventHandler
public void onChatDistort(PlayerChatDistortEvent event) {
this.event = event;
this.playerTag = new PlayerTag(event.getPlayer());
fire(event);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.denizenscript.depenizen.bukkit.events.breweryx;


import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.objects.ItemTag;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.denizenscript.depenizen.bukkit.objects.breweryx.BreweryRecipeTag;
import com.dre.brewery.api.events.brew.BrewDrinkEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class BreweryDrinkScriptEvent extends BukkitScriptEvent implements Listener {

// <--[event]
// @Events
// brewery drink
//
// @Cancellable true
//
// @Triggers when a player drinks a potion that is considered a BreweryX potion.
//
// @Context
// <context.item> Returns an ItemTag of the potion that was drunk.
// <context.recipe> Returns an BreweryRecipeTag of the recipe that the brew is based off of.
// <context.player> Returns a PlayerTag of the player that drank the brew.
//
// @Plugin Depenizen, BreweryX
//
// @Player Always.
//
// @Group Depenizen
//
// -->
public BreweryDrinkScriptEvent() {
registerCouldMatcher("brewery drink");
}

public BrewDrinkEvent event;

@Override
public boolean matches(ScriptPath path) {
return super.matches(path);
}

@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(event.getPlayer());
}

@Override
public ObjectTag getContext(String name) {
return switch (name) {
case "recipe" -> new BreweryRecipeTag(event.getBrew().getCurrentRecipe());
case "item" -> new ItemTag(event.getBrew().createItem(event.getBrew().getCurrentRecipe(), false));
case "player" -> new PlayerTag(event.getPlayer());
default -> super.getContext(name);
};
}

@EventHandler
public void onBrewDrinkEvent(BrewDrinkEvent event) {
this.event = event;
fire(event);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.denizenscript.depenizen.bukkit.events.breweryx;

import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.objects.ItemTag;
import com.denizenscript.denizen.objects.LocationTag;
import com.denizenscript.denizen.objects.PlayerTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.dre.brewery.api.events.IngedientAddEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class BreweryIngredientAddScriptEvent extends BukkitScriptEvent implements Listener {

// <--[event]
// @Events
// brewery ingredient add
//
// @Cancellable true
//
// @Triggers when a player adds an ingredient to a cauldron.
//
// @Context
// <context.item> Returns an ItemTag of the ingredient that was added.
// <context.location> Returns a LocationTag of the cauldron.
// <context.player> Returns a PlayerTag of the player that added the ingredient.
// <context.take_item> Returns an ElementTag of whether the item should be taken from the player.
//
// @Determine
// ItemTag to set the ingredient that was added.
// ElementTag(Boolean) to set whether the item should be taken from the player.
//
// @Plugin Depenizen, BreweryX
//
// @Player Always.
//
// @Group Depenizen
//
// -->
public BreweryIngredientAddScriptEvent() {
registerCouldMatcher("brewery ingredient add");
}

public IngedientAddEvent event;

@Override
public boolean matches(ScriptPath path) {
return super.matches(path);
}

@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(event.getPlayer());
}

@Override
public ObjectTag getContext(String name) {
return switch (name) {
case "location" -> new LocationTag(event.getBlock().getLocation());
case "player" -> new PlayerTag(event.getPlayer());
case "item" -> new ItemTag(event.getIngredient());
case "take_item" -> new ElementTag(event.willTakeItem());
default -> super.getContext(name);
};
}

@Override
public boolean handleDetermination(ScriptPath path, String prefix, ObjectTag value) {
switch (prefix) {
case "item" -> {
event.setIngredient(((ItemTag) value).getItemStack());
return true;
}
case "take_item" -> {
event.setTakeItem(((ElementTag) value).asBoolean());
return true;
}
}
return super.handleDetermination(path, prefix, value);
}

@EventHandler
public void onIngredientAddEvent(IngedientAddEvent event) {
this.event = event;
fire(event);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.denizenscript.depenizen.bukkit.events.breweryx;

import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.objects.ItemTag;
import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData;
import com.denizenscript.denizencore.objects.ObjectTag;
import com.denizenscript.denizencore.objects.core.ElementTag;
import com.denizenscript.denizencore.scripts.ScriptEntryData;
import com.denizenscript.depenizen.bukkit.objects.breweryx.BreweryRecipeTag;
import com.dre.brewery.api.events.brew.BrewModifyEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class BreweryModifyBrewScriptEvent extends BukkitScriptEvent implements Listener {

// <--[event]
// @Events
// brewery brew modify
//
// @Cancellable true
//
// @Triggers When a Brew has been created or modified.
// Usually happens on filling from cauldron, distilling and aging.
// Modifications to the Brew or the PotionMeta can be done now
// Cancelling reverts the Brew to the state it was before the modification
//
// @Context
// <context.recipe> Returns an BreweryRecipeTag of the recipe that the brew is based off of.
// <context.item> Returns an ItemTag of the potion.
// <context.type> Returns an ElementTag of the type of modification.
//
// @Plugin Depenizen, BreweryX
//
// @Group Depenizen
//
// -->
public BreweryModifyBrewScriptEvent() {
registerCouldMatcher("brewery brew modify");
}

public BrewModifyEvent event;

@Override
public boolean matches(ScriptPath path) {
return super.matches(path);
}

@Override
public ScriptEntryData getScriptEntryData() {
return new BukkitScriptEntryData(null, null);
}

@Override
public ObjectTag getContext(String name) {
return switch (name) {
case "recipe" -> new BreweryRecipeTag(event.getBrew().getCurrentRecipe());
case "item" -> new ItemTag(event.getBrew().createItem(event.getBrew().getCurrentRecipe(), false));
case "type" -> new ElementTag(event.getType());
default -> super.getContext(name);
};
}

@EventHandler
public void onBrewModifyEvent(BrewModifyEvent event) {
this.event = event;
fire(event);
}
}
Loading