Skip to content

Commit

Permalink
Partial Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAbsolutionism committed Sep 22, 2024
1 parent 4a4afde commit f7915aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
13 changes: 5 additions & 8 deletions src/main/java/ch/njol/skript/effects/EffRemoveResourcePack.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class EffRemoveResourcePack extends Effect {
@Override
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
pattern = matchedPattern;
if (matchedPattern == 2) {
if (matchedPattern == 1) {
id = (Expression<String>) exprs[0];
recipients = (Expression<Player>) exprs[1];
} else {
Expand All @@ -62,11 +62,11 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye
@Override
protected void execute(Event event) {
UUID uuid = null;
if (pattern == 2) {
if (pattern == 1) {
try {
uuid = UUID.fromString(id.getSingle(event));
} catch (IllegalArgumentException exception) {
Skript.error("Remove Resource Pack UUID failed: " + exception.getLocalizedMessage(), ErrorQuality.SEMANTIC_ERROR);
Skript.error("Remove Resource Pack UUID failed: " + exception.getLocalizedMessage());
}
if (uuid == null) {
return;
Expand All @@ -87,12 +87,9 @@ protected void execute(Event event) {

@Override
public String toString(@Nullable Event event, boolean debug) {
if (pattern == 1) {
if (pattern == 0)
return "remove all resource packs from " + recipients.toString(event, debug);
} else if (pattern == 2) {
return "remove resource pack with the uuid " + id.toString(event, debug) + " from " + recipients.toString(event, debug);
}
return "null";
return "remove resource pack with the uuid " + id.toString(event, debug) + " from " + recipients.toString(event, debug);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public void setForce(Boolean force) {
return force;
}


@Override
public @NotNull HandlerList getHandlers() {
throw new IllegalStateException();
Expand All @@ -102,10 +101,8 @@ public void setForce(Boolean force) {
"send [a|the] resource pack [at|from [[the] URL]] %string% to %players%",
"send [a|the] resource pack [at|from [[the] URL]] %string% with hash %string% to %players%"
);

}


private @UnknownNullability Expression<String> url;
private @UnknownNullability Expression<Player> recipients;
private @Nullable Trigger trigger;
Expand Down Expand Up @@ -137,7 +134,6 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye
return true;
}


@Override
protected @Nullable TriggerItem walk(Event event) {
debug(event, true);
Expand Down Expand Up @@ -192,7 +188,6 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye
return super.walk(event, false);
}


@Override
public String toString(@Nullable Event event, boolean debug) {
String result = "send the resource pack from the URL " + url.toString(event, debug);
Expand Down

0 comments on commit f7915aa

Please sign in to comment.