Skip to content

Commit

Permalink
10.0.0.0
Browse files Browse the repository at this point in the history
- Added debug method to the main plugin class

- Updated repository URL for API

- Added cheat prevention option force disable the "allow flight" option for a tagged player
  • Loading branch information
SirBlobman committed Jan 15, 2020
1 parent bfa20cf commit 2e8c28d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 22 deletions.
6 changes: 3 additions & 3 deletions api/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ You can use it to create new expansions or to check stuff with your own plugin
A lot of developers use maven to build projects more easily.
CodeMC was nice enough to sponsor a maven repository for CombatLogX

**Repository: CodeMC Snapshots**
**Repository: CodeMC Public**
```xml
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
<id>codemc-repo</id>
<url>https://repo.codemc.io/repository/maven-public/</url>
</repository>
```

Expand Down
35 changes: 18 additions & 17 deletions api/src/main/java/com/SirBlobman/combatlogx/api/ICombatLogX.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
* @author SirBlobman
*/
public interface ICombatLogX {
public JavaPlugin getPlugin();
public Logger getLogger();
JavaPlugin getPlugin();
Logger getLogger();

public File getDataFolder();
File getDataFolder();

/**
* Register a command to CombatLogX
Expand All @@ -33,23 +33,24 @@ public interface ICombatLogX {
* @param aliases The alias list of the command
* @see CommandExecutor
*/
public void registerCommand(String commandName, CommandExecutor executor, String description, String usage, String... aliases);
void registerCommand(String commandName, CommandExecutor executor, String description, String usage, String... aliases);

public FileConfiguration getConfig(String fileName);
public void reloadConfig(String fileName);
public void saveConfig(String fileName);
public void saveDefaultConfig(String fileName);
FileConfiguration getConfig(String fileName);
void reloadConfig(String fileName);
void saveConfig(String fileName);
void saveDefaultConfig(String fileName);

public YamlConfiguration getDataFile(OfflinePlayer user);
public void saveDataFile(OfflinePlayer user, YamlConfiguration config);
YamlConfiguration getDataFile(OfflinePlayer user);
void saveDataFile(OfflinePlayer user, YamlConfiguration config);

public String getLanguageMessage(String path);
public String getLanguageMessageColored(String path);
public String getLanguageMessageColoredWithPrefix(String path);
String getLanguageMessage(String path);
String getLanguageMessageColored(String path);
String getLanguageMessageColoredWithPrefix(String path);

public ClassLoader getPluginClassLoader();
public ICombatManager getCombatManager();
public ICustomDeathListener getCustomDeathListener();
ClassLoader getPluginClassLoader();
ICombatManager getCombatManager();
ICustomDeathListener getCustomDeathListener();

public void sendMessage(CommandSender sender, String... messages);
void sendMessage(CommandSender sender, String... messages);
void printDebug(String message);
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public void onTag(PlayerTagEvent e) {
if(!player.isFlying()) return;

player.setFlying(false);
this.preventFallDamage.add(player.getUniqueId());
if(config.getBoolean("flight.force-disable-flight")) player.setAllowFlight(false);

UUID uuid = player.getUniqueId();
this.preventFallDamage.add(uuid);

String message = this.plugin.getLanguageMessageColoredWithPrefix("cheat-prevention.flight.force-disabled");
this.plugin.sendMessage(player, message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ flight:
# Default: true
prevent-flying: true

# Set this to true to set the allowFlight flag to 'false' for the player when they enter into combat
# This may cause issues with some custom flight plugins so it is disabled by default
#
# Default: false
force-disable-flight: true

# This option will prevent fall damage if a player lost their flight due to CombatLogX
#
# Default: true
Expand Down
14 changes: 13 additions & 1 deletion plugin/src/main/java/com/SirBlobman/combatlogx/CombatLogX.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

import com.SirBlobman.combatlogx.api.ICombatLogX;
Expand Down Expand Up @@ -214,7 +215,18 @@ public void sendMessage(CommandSender sender, String... messages) {
sender.sendMessage(message);
}
}


@Override
public void printDebug(String message) {
if(message == null || message.isEmpty()) return;

FileConfiguration config = getConfig("config.yml");
if(!config.getBoolean("debug")) return;

Logger logger = getLogger();
logger.info("[Debug] " + message);
}

private void forceRegisterCommand(String commandName, CommandExecutor executor, String description, String usage, String... aliases) {
if(commandName == null || executor == null || description == null || usage == null || aliases == null) return;

Expand Down

0 comments on commit 2e8c28d

Please sign in to comment.