Skip to content

Commit

Permalink
less bork with vehicle exit for non-vanilla-vehicles
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 3, 2021
1 parent cdeecdf commit 990d3e1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -55,7 +55,7 @@ Copyright (C) 2013-2019 The Denizen Script Team, All Rights Reserved.

The MIT License (MIT)

Copyright (c) 2019-2020 The Denizen Script Team
Copyright (c) 2019-2021 The Denizen Script Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Expand Up @@ -116,6 +116,16 @@ public boolean couldMatchEntity(String text) {
return genericCouldMatchChecks(text, this::couldMatchEntity);
}

public boolean exactMatchEntity(String text) {
if (specialEntityMatchables.contains(text)) {
return true;
}
if (EntityTag.matches(text)) {
return true;
}
return false;
}

public boolean exactMatchesVehicle(String text) {
if (text.equals("vehicle")) {
return true;
Expand Down
Expand Up @@ -63,8 +63,10 @@ public boolean couldMatch(ScriptPath path) {

@Override
public boolean matches(ScriptPath path) {
if (!tryEntity(entity, path.eventArgLowerAt(0))
|| !tryEntity(vehicle, path.eventArgLowerAt(2))) {
if (!tryEntity(entity, path.eventArgLowerAt(0))) {
return false;
}
if (!path.eventArgLowerAt(2).equals("vehicle") && !tryEntity(vehicle, path.eventArgLowerAt(2))) {
return false;
}
if (!runInCheck(path, vehicle.getLocation())) {
Expand Down
Expand Up @@ -70,7 +70,7 @@ public boolean couldMatch(ScriptPath path) {
if (path.eventArgLowerAt(2).equals("biome") || exactMatchesEnum(path.eventArgLowerAt(2), Biome.values())) {
return false;
}
if (exactMatchesVehicle(path.eventArgLowerAt(2))) {
if (exactMatchEntity(path.eventArgLowerAt(2))) {
return false;
}
if (path.eventArgLowerAt(2).equals("bed") || path.eventArgLowerAt(2).equals("portal")) {
Expand Down

0 comments on commit 990d3e1

Please sign in to comment.