mirror of
https://github.com/TotalFreedomMC/TF-Marriage.git
synced 2024-12-28 11:04:24 +00:00
TF customizations because nodes wouldn't work
This commit is contained in:
parent
bc4f234a67
commit
fc73795ae4
8 changed files with 80 additions and 1 deletions
14
pom.xml
14
pom.xml
|
@ -39,13 +39,18 @@
|
|||
<id>IntellectualSites</id>
|
||||
<url>https://mvn.intellectualsites.com/content/groups/public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -81,6 +86,13 @@
|
|||
<version>5.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.TFPatches</groupId>
|
||||
<artifactId>TotalFreedomMod</artifactId>
|
||||
<version>4328a13eaf</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -20,6 +20,8 @@ public interface Marriage {
|
|||
*/
|
||||
BConfig getBukkitConfig(String file);
|
||||
|
||||
TFM getTFM();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
|
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.config.Message;
|
||||
import com.lenis0012.bukkit.marriage2.config.Permissions;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CommandChatSpy extends Command {
|
||||
public CommandChatSpy(Marriage marriage) {
|
||||
|
@ -15,6 +16,11 @@ public class CommandChatSpy extends Command {
|
|||
|
||||
@Override
|
||||
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);
|
||||
boolean mode = !mPlayer.isChatSpy();
|
||||
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.Permissions;
|
||||
import com.lenis0012.bukkit.marriage2.config.Settings;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
|
@ -26,6 +27,11 @@ public class CommandPriest extends Command {
|
|||
|
||||
@Override
|
||||
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);
|
||||
Player player = getArgAsPlayer(1);
|
||||
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.internal.MarriagePlugin;
|
||||
import com.lenis0012.pluginutils.modules.configuration.ConfigurationModule;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CommandReload extends Command {
|
||||
|
||||
|
@ -21,6 +22,11 @@ public class CommandReload extends Command {
|
|||
|
||||
@Override
|
||||
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();
|
||||
ConfigurationModule module = plugin.getModule(ConfigurationModule.class);
|
||||
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.Version;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CommandUpdate extends Command {
|
||||
|
@ -17,6 +18,11 @@ public class CommandUpdate extends Command {
|
|||
|
||||
@Override
|
||||
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 Version version = updater.getNewVersion();
|
||||
if(version == null) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.lenis0012.bukkit.marriage2.internal;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.ClassPath;
|
||||
import com.lenis0012.bukkit.marriage2.Marriage;
|
||||
import com.lenis0012.bukkit.marriage2.TFM;
|
||||
import com.lenis0012.bukkit.marriage2.commands.Command;
|
||||
import com.lenis0012.bukkit.marriage2.misc.BConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -18,6 +19,7 @@ public abstract class MarriageBase implements Marriage {
|
|||
protected final MarriagePlugin plugin;
|
||||
private final ClassPath classPath;
|
||||
private MarriageCommandExecutor commandExecutor;
|
||||
private TFM tfm = new TFM();
|
||||
|
||||
public MarriageBase(MarriagePlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
@ -38,6 +40,11 @@ public abstract class MarriageBase implements Marriage {
|
|||
Bukkit.getPluginManager().registerEvents(listener, plugin);
|
||||
}
|
||||
|
||||
public TFM getTFM()
|
||||
{
|
||||
return tfm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(Class<? extends Command> commandClass, Class<? extends Command>... commandClasses) {
|
||||
commandExecutor.register(commandClass);
|
||||
|
|
Loading…
Reference in a new issue