mirror of
https://github.com/TotalFreedomMC/TF-Marriage.git
synced 2024-05-29 08:01:23 +00:00
TF customizations because nodes wouldn't work
This commit is contained in:
parent
bc4f234a67
commit
fc73795ae4
14
pom.xml
14
pom.xml
|
@ -39,13 +39,18 @@
|
||||||
<id>IntellectualSites</id>
|
<id>IntellectualSites</id>
|
||||||
<url>https://mvn.intellectualsites.com/content/groups/public/</url>
|
<url>https://mvn.intellectualsites.com/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -81,6 +86,13 @@
|
||||||
<version>5.1</version>
|
<version>5.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.TFPatches</groupId>
|
||||||
|
<artifactId>TotalFreedomMod</artifactId>
|
||||||
|
<version>4328a13eaf</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
|
|
@ -20,6 +20,8 @@ public interface Marriage {
|
||||||
*/
|
*/
|
||||||
BConfig getBukkitConfig(String file);
|
BConfig getBukkitConfig(String file);
|
||||||
|
|
||||||
|
TFM getTFM();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link com.lenis0012.bukkit.marriage2.MPlayer MPlayer} instance of a player.
|
* Return a {@link com.lenis0012.bukkit.marriage2.MPlayer MPlayer} instance of a player.
|
||||||
* If the requested player is not online, their data will be loaded from the database, but it will NOT be cached.
|
* If the requested player is not online, their data will be loaded from the database, but it will NOT be cached.
|
||||||
|
|
34
src/main/java/com/lenis0012/bukkit/marriage2/TFM.java
Normal file
34
src/main/java/com/lenis0012/bukkit/marriage2/TFM.java
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
package com.lenis0012.bukkit.marriage2;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
public class TFM {
|
||||||
|
|
||||||
|
private TotalFreedomMod totalFreedomMod = null;
|
||||||
|
|
||||||
|
public TotalFreedomMod getTFM()
|
||||||
|
{
|
||||||
|
if (totalFreedomMod != null)
|
||||||
|
{
|
||||||
|
return totalFreedomMod;
|
||||||
|
}
|
||||||
|
Plugin plugin = Bukkit.getPluginManager().getPlugin("TotalFreedomMod");
|
||||||
|
if (plugin != null && plugin.isEnabled())
|
||||||
|
{
|
||||||
|
TotalFreedomMod tfm = (TotalFreedomMod)plugin;
|
||||||
|
totalFreedomMod = tfm;
|
||||||
|
return totalFreedomMod;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdmin(Player player)
|
||||||
|
{
|
||||||
|
return getTFM().al.isAdmin(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import com.lenis0012.bukkit.marriage2.MPlayer;
|
||||||
import com.lenis0012.bukkit.marriage2.Marriage;
|
import com.lenis0012.bukkit.marriage2.Marriage;
|
||||||
import com.lenis0012.bukkit.marriage2.config.Message;
|
import com.lenis0012.bukkit.marriage2.config.Message;
|
||||||
import com.lenis0012.bukkit.marriage2.config.Permissions;
|
import com.lenis0012.bukkit.marriage2.config.Permissions;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
public class CommandChatSpy extends Command {
|
public class CommandChatSpy extends Command {
|
||||||
public CommandChatSpy(Marriage marriage) {
|
public CommandChatSpy(Marriage marriage) {
|
||||||
|
@ -15,6 +16,11 @@ public class CommandChatSpy extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
if (!marriage.getTFM().isAdmin(player))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.RED + "You are not permitted to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
MPlayer mPlayer = marriage.getMPlayer(player);
|
MPlayer mPlayer = marriage.getMPlayer(player);
|
||||||
boolean mode = !mPlayer.isChatSpy();
|
boolean mode = !mPlayer.isChatSpy();
|
||||||
mPlayer.setChatSpy(mode);
|
mPlayer.setChatSpy(mode);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.lenis0012.bukkit.marriage2.Marriage;
|
||||||
import com.lenis0012.bukkit.marriage2.config.Message;
|
import com.lenis0012.bukkit.marriage2.config.Message;
|
||||||
import com.lenis0012.bukkit.marriage2.config.Permissions;
|
import com.lenis0012.bukkit.marriage2.config.Permissions;
|
||||||
import com.lenis0012.bukkit.marriage2.config.Settings;
|
import com.lenis0012.bukkit.marriage2.config.Settings;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,6 +27,11 @@ public class CommandPriest extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
if (!marriage.getTFM().isAdmin(player))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.RED + "You are not permitted to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
String type = getArg(0);
|
String type = getArg(0);
|
||||||
Player player = getArgAsPlayer(1);
|
Player player = getArgAsPlayer(1);
|
||||||
if(player == null) {
|
if(player == null) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.lenis0012.bukkit.marriage2.config.Permissions;
|
||||||
import com.lenis0012.bukkit.marriage2.config.Settings;
|
import com.lenis0012.bukkit.marriage2.config.Settings;
|
||||||
import com.lenis0012.bukkit.marriage2.internal.MarriagePlugin;
|
import com.lenis0012.bukkit.marriage2.internal.MarriagePlugin;
|
||||||
import com.lenis0012.pluginutils.modules.configuration.ConfigurationModule;
|
import com.lenis0012.pluginutils.modules.configuration.ConfigurationModule;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
public class CommandReload extends Command {
|
public class CommandReload extends Command {
|
||||||
|
|
||||||
|
@ -21,6 +22,11 @@ public class CommandReload extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
if (!marriage.getTFM().isAdmin(player))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.RED + "You are not permitted to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
MarriagePlugin plugin = (MarriagePlugin) marriage.getPlugin();
|
MarriagePlugin plugin = (MarriagePlugin) marriage.getPlugin();
|
||||||
ConfigurationModule module = plugin.getModule(ConfigurationModule.class);
|
ConfigurationModule module = plugin.getModule(ConfigurationModule.class);
|
||||||
module.reloadSettings(Settings.class, false);
|
module.reloadSettings(Settings.class, false);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.lenis0012.bukkit.marriage2.internal.MarriageCore;
|
||||||
import com.lenis0012.updater.api.Updater;
|
import com.lenis0012.updater.api.Updater;
|
||||||
import com.lenis0012.updater.api.Version;
|
import com.lenis0012.updater.api.Version;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class CommandUpdate extends Command {
|
public class CommandUpdate extends Command {
|
||||||
|
@ -17,6 +18,11 @@ public class CommandUpdate extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
if (!marriage.getTFM().isAdmin(player))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.RED + "You are not permitted to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Updater updater = ((MarriageCore) marriage).getUpdater();
|
final Updater updater = ((MarriageCore) marriage).getUpdater();
|
||||||
final Version version = updater.getNewVersion();
|
final Version version = updater.getNewVersion();
|
||||||
if(version == null) {
|
if(version == null) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.lenis0012.bukkit.marriage2.internal;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.reflect.ClassPath;
|
import com.google.common.reflect.ClassPath;
|
||||||
import com.lenis0012.bukkit.marriage2.Marriage;
|
import com.lenis0012.bukkit.marriage2.Marriage;
|
||||||
|
import com.lenis0012.bukkit.marriage2.TFM;
|
||||||
import com.lenis0012.bukkit.marriage2.commands.Command;
|
import com.lenis0012.bukkit.marriage2.commands.Command;
|
||||||
import com.lenis0012.bukkit.marriage2.misc.BConfig;
|
import com.lenis0012.bukkit.marriage2.misc.BConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -18,6 +19,7 @@ public abstract class MarriageBase implements Marriage {
|
||||||
protected final MarriagePlugin plugin;
|
protected final MarriagePlugin plugin;
|
||||||
private final ClassPath classPath;
|
private final ClassPath classPath;
|
||||||
private MarriageCommandExecutor commandExecutor;
|
private MarriageCommandExecutor commandExecutor;
|
||||||
|
private TFM tfm = new TFM();
|
||||||
|
|
||||||
public MarriageBase(MarriagePlugin plugin) {
|
public MarriageBase(MarriagePlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
@ -38,6 +40,11 @@ public abstract class MarriageBase implements Marriage {
|
||||||
Bukkit.getPluginManager().registerEvents(listener, plugin);
|
Bukkit.getPluginManager().registerEvents(listener, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TFM getTFM()
|
||||||
|
{
|
||||||
|
return tfm;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(Class<? extends Command> commandClass, Class<? extends Command>... commandClasses) {
|
public void register(Class<? extends Command> commandClass, Class<? extends Command>... commandClasses) {
|
||||||
commandExecutor.register(commandClass);
|
commandExecutor.register(commandClass);
|
||||||
|
|
Loading…
Reference in a new issue