Skip to content

Commit 7648b48

Browse files
author
Valandur
committed
Merge branch 'release/v5.2.2'
2 parents 15c7d17 + 392040b commit 7648b48

24 files changed

Lines changed: 85 additions & 64 deletions

build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ blossom {
1616
spongestart {
1717
eula true
1818
minecraft project.minecraftVersion
19-
spongeForgeVersion "1.12.2-2705-7.1.0-BETA-3243"
20-
spongeVanillaVersion "1.12.2-7.1.0-BETA-75"
19+
spongeForgeVersion "1.12.2-2705-7.1.0-BETA-3399"
20+
spongeVanillaVersion "1.12.2-7.1.0-BETA-105"
21+
//spongeForgeVersion "1.12.2-2705-8.0.0-BETA-3398"
22+
//spongeVanillaVersion "1.12.2-8.0.0-BETA-444"
2123
}
2224

2325
configurations.all {
@@ -87,7 +89,7 @@ dependencies {
8789
compileOnly name: "GWMLibrary 1.3.2"
8890
compileOnly name: "GWMCrates beta-3.1.2"
8991
compileOnly name: "HuskyCrates-v1.8.0PRE2-API7"
90-
compileOnly name: "MMCRestrict-1.4.2-API-7"
92+
compileOnly name: "MMCRestrict-1.5.1-API-7"
9193
compileOnly name: "MMCTickets-1.4.1-API-7"
9294
compileOnly name: "Nucleus-1.3.3-S7.0-api"
9395
compileOnly name: "RedProtect-7.3.0-b68-Universal"

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=5.2.1
1+
version=5.2.2
22
minecraftVersion=1.12.2
33
spongeVersion=7.1
44
jacksonVersion=2.9.4

src/main/java/valandur/webapi/config/HookConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ private static Map<String, CommandWebHook> defaultCommandHooks() {
4646

4747
@Setting(comment = "The following are event hooks which are all called when the specified event happens. They get passed various data\n" +
4848
"in the body (if method != GET, described below for each event). The format of the hooks is described in the \"all\"\n" +
49-
"event hook. This format can be used anywhere marked with \"HOOKS\".\n" +
49+
"event hook. This format can be used for any of the hook lists.\n" +
5050
"Please note that the hooks don't get called in any particular order, and might even be called concurrently.")
5151
public HookEvents events = new HookEvents();
5252

5353
@Setting(comment = "These hooks can be used to bind to custom events. You have to use the fully qualified class name as the key, and then\n" +
54-
"a hook list just like for the event hooks above. These hooks work just like the event hooks, although the data\n" +
54+
"a hook list just like for the event hooks. These hooks work just like the event hooks, although the data\n" +
5555
"depends on the event you subscribe to.")
5656
public Map<String, List<WebHook>> custom = new HashMap<>();
5757

@@ -63,7 +63,7 @@ private static Map<String, CommandWebHook> defaultCommandHooks() {
6363

6464
@ConfigSerializable
6565
public static class HookEvents {
66-
@Setting(comment = "This event is fired for all other events. The \"X-WebAPI-Event\" header specifies the exact event.")
66+
@Setting(comment = "This event is fired for all events. The \"X-WebAPI-Event\" header specifies the exact event.")
6767
public List<WebHook> all = Lists.newArrayList(new WebHook(
6868
"http://localhost/test",
6969
false,
@@ -78,7 +78,7 @@ public static class HookEvents {
7878
@Setting(comment = "This event is fired when a player earns an achievement / advancement")
7979
public List<WebHook> achievement = new ArrayList<>();
8080

81-
@Setting(comment = "This event is fired when a block operations changes status")
81+
@Setting(comment = "This event is fired when a block operation changes status")
8282
public List<WebHook> block_operation_status = new ArrayList<>();
8383

8484
@Setting(comment = "This event is fired when a chat message is sent on the server")

src/main/java/valandur/webapi/hook/CommandWebHook.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public List<String> getAliases() {
2525

2626
@Setting(comment = "Here you have to specify what parameters are used.\n" +
2727
"These parameters must be included when running the command. So the example command below would have to be\n" +
28-
"run using the following syntax: /webapi notfy test {player} {world}\n" +
28+
"run using the following syntax: /webapi notify test {player} {world}\n" +
2929
"\n" +
3030
"The body automatically contains all the parameters that are listed here. The parameters are expected to\n" +
3131
"show up in this order when calling the command. There is a special parameter 'source' which is always\n" +

src/main/java/valandur/webapi/hook/WebHookService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.spongepowered.api.event.filter.cause.First;
2222
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
2323
import org.spongepowered.api.event.game.state.GameStoppedServerEvent;
24+
import org.spongepowered.api.event.game.state.GameStoppingEvent;
2425
import org.spongepowered.api.event.item.inventory.InteractInventoryEvent;
2526
import org.spongepowered.api.event.message.MessageChannelEvent;
2627
import org.spongepowered.api.event.network.ClientConnectionEvent;
@@ -321,7 +322,7 @@ public void onServerStart(GameStartedServerEvent event) {
321322
notifyHooks(WebHookService.WebHookType.SERVER_START, event);
322323
}
323324
@Listener(order = Order.PRE)
324-
public void onServerStop(GameStoppedServerEvent event) {
325+
public void onServerStop(GameStoppingEvent event) {
325326
notifyHooks(WebHookService.WebHookType.SERVER_STOP, event);
326327
}
327328

src/main/java/valandur/webapi/integration/mmcrestrict/CachedItemData.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public Boolean getDropBanned() {
5959
return dropBanned;
6060
}
6161

62+
private Boolean craftBanned;
63+
@ApiModelProperty(value = "True if crafting this item is banned, false otherwise", required = true)
64+
public Boolean getCraftBanned() {
65+
return craftBanned;
66+
}
67+
6268
private Boolean worldBanned;
6369
@ApiModelProperty(value = "True if this item is banned from the world, false otherwise?", required = true)
6470
public Boolean getWorldBanned() {
@@ -79,6 +85,7 @@ public CachedItemData(ItemData value) {
7985
this.breakingBanned = value.getBreakingbanned();
8086
this.placingBanned = value.getPlacingbanned();
8187
this.dropBanned = value.getDropbanned();
88+
this.craftBanned = value.getCraftbanned();
8289
this.worldBanned = value.getWorldbanned();
8390
}
8491

@@ -93,6 +100,7 @@ public Optional<ItemData> getLive() {
93100
placingBanned != null ? placingBanned : false,
94101
ownershipBanned != null ? ownershipBanned : true,
95102
dropBanned != null ? dropBanned : false,
103+
craftBanned != null ? craftBanned : false,
96104
worldBanned != null ? worldBanned : false));
97105
}
98106

src/main/java/valandur/webapi/message/InteractiveMessage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public UUID getUUID() {
3535
* The id of the message. Useful to identify it in the response.
3636
* @return The id of the message.
3737
*/
38-
@ApiModelProperty(value = "The id of the message. Used for sender of the message to identify responses.", required = true)
38+
@ApiModelProperty(value = "The id of the message. Used to identify responses.", required = true)
3939
public String getId() {
4040
return id;
4141
}
@@ -81,8 +81,8 @@ public Text getMessage() {
8181
*/
8282
@ApiModelProperty("True if this message can only be replied to once per target, false otherwise")
8383
@JsonDetails
84-
public Boolean isOnce() {
85-
return once;
84+
public boolean isOnce() {
85+
return once != null && once;
8686
}
8787

8888
private List<InteractiveMessageOption> options;

src/main/java/valandur/webapi/message/InteractiveMessageService.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void sendMessage(InteractiveMessage msg) {
4242
builder.append(msg.getMessage());
4343
}
4444

45-
if (msg.isOnce() != null && msg.isOnce()) {
45+
if (msg.isOnce()) {
4646
replied.put(msg.getUUID(), new ConcurrentSkipListSet<>());
4747
}
4848

@@ -57,7 +57,7 @@ public void sendMessage(InteractiveMessage msg) {
5757
Collection<String> replies = replied.get(msg.getUUID());
5858
if (replies.contains(source.getIdentifier())) {
5959
source.sendMessage(Text
60-
.builder("You have already replied to this messsage")
60+
.builder("You have already replied to this message")
6161
.color(TextColors.RED)
6262
.build()
6363
);
@@ -66,7 +66,8 @@ public void sendMessage(InteractiveMessage msg) {
6666
replies.add(source.getIdentifier());
6767
}
6868

69-
InteractiveMessageResponse response = new InteractiveMessageResponse(msg.getId(), data, source.getIdentifier());
69+
InteractiveMessageResponse response = new InteractiveMessageResponse(
70+
msg.getId(), data, source.getIdentifier());
7071
WebAPI.getWebHookService().notifyHooks(WebHookService.WebHookType.INTERACTIVE_MESSAGE, response);
7172
})).build();
7273

src/main/java/valandur/webapi/serialize/deserialize/BlockStateDeserializer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ public BlockStateDeserializer() {
2525
@Override
2626
public BlockState deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
2727
JsonNode root = p.readValueAsTree();
28-
if (root.path("type").path("id").isMissingNode()) {
29-
return null;
28+
if (root.path("type").isMissingNode()) {
29+
throw new IOException("Missing block type");
3030
}
3131

32-
String typeStr = root.path("type").path("id").asText();
32+
String typeStr = root.path("type").isTextual()
33+
? root.path("type").asText()
34+
: root.path("type").path("id").asText();
3335
Optional<BlockType> optType = Sponge.getRegistry().getType(BlockType.class, typeStr);
3436
if (!optType.isPresent()) {
3537
throw new IOException("Invalid block type " + typeStr);

0 commit comments

Comments
 (0)