mirror of
https://github.com/filoghost/ChestCommands.git
synced 2024-11-26 03:55:40 +01:00
Separate variables in new package
This commit is contained in:
parent
7410d89f3c
commit
6261c318b0
@ -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 {
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user