Separate variables in new package

This commit is contained in:
filoghost 2020-06-06 21:23:19 +02:00
parent 7410d89f3c
commit 6261c318b0
5 changed files with 40 additions and 40 deletions

View File

@ -17,7 +17,7 @@ package me.filoghost.chestcommands.action;
import org.bukkit.entity.Player;
import me.filoghost.chestcommands.config.AsciiPlaceholders;
import me.filoghost.chestcommands.internal.VariableManager;
import me.filoghost.chestcommands.variable.VariableManager;
public abstract class Action {

View File

@ -25,8 +25,8 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.SkullMeta;
import me.filoghost.chestcommands.ChestCommands;
import me.filoghost.chestcommands.internal.VariableManager;
import me.filoghost.chestcommands.util.Utils;
import me.filoghost.chestcommands.variable.VariableManager;
import java.util.ArrayList;
import java.util.Arrays;

View File

@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package me.filoghost.chestcommands.internal;
package me.filoghost.chestcommands.variable;
import org.bukkit.Bukkit;

View File

@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package me.filoghost.chestcommands.internal;
package me.filoghost.chestcommands.variable;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

View File

@ -1,36 +1,36 @@
package me.filoghost.chestcommands.internal;
import org.bukkit.entity.Player;
import me.filoghost.chestcommands.bridge.PlaceholderAPIBridge;
public class VariableManager {
public static boolean hasVariables(String message) {
if(message == null) {
return false;
}
for (Variable variable : Variable.values()) {
if (message.contains(variable.getText())) {
return true;
}
}
if (PlaceholderAPIBridge.hasValidPlugin() && PlaceholderAPIBridge.hasPlaceholders(message)) {
return true;
}
return false;
}
public static String setVariables(String message, Player executor) {
for (Variable variable : Variable.values()) {
if (message.contains(variable.getText())) {
message = message.replace(variable.getText(), variable.getReplacement(executor));
}
}
if (PlaceholderAPIBridge.hasValidPlugin()) {
message = PlaceholderAPIBridge.setPlaceholders(message, executor);
}
return message;
}
}
package me.filoghost.chestcommands.variable;
import org.bukkit.entity.Player;
import me.filoghost.chestcommands.bridge.PlaceholderAPIBridge;
public class VariableManager {
public static boolean hasVariables(String message) {
if(message == null) {
return false;
}
for (Variable variable : Variable.values()) {
if (message.contains(variable.getText())) {
return true;
}
}
if (PlaceholderAPIBridge.hasValidPlugin() && PlaceholderAPIBridge.hasPlaceholders(message)) {
return true;
}
return false;
}
public static String setVariables(String message, Player executor) {
for (Variable variable : Variable.values()) {
if (message.contains(variable.getText())) {
message = message.replace(variable.getText(), variable.getReplacement(executor));
}
}
if (PlaceholderAPIBridge.hasValidPlugin()) {
message = PlaceholderAPIBridge.setPlaceholders(message, executor);
}
return message;
}
}