parent
9e4db8fb3e
commit
0d26d6c65b
2
pom.xml
2
pom.xml
|
|
@ -58,7 +58,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.11-R0.1-SNAPSHOT</version>
|
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--Worldguard dependency-->
|
<!--Worldguard dependency-->
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import me.ryanhamshire.GriefPrevention.events.ClaimDeletedEvent;
|
import me.ryanhamshire.GriefPrevention.events.ClaimDeletedEvent;
|
||||||
|
|
||||||
|
import me.ryanhamshire.GriefPrevention.events.DeniedMessageEvent;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
@ -41,6 +42,8 @@ import com.google.common.io.Files;
|
||||||
//singleton class which manages all GriefPrevention data (except for config options)
|
//singleton class which manages all GriefPrevention data (except for config options)
|
||||||
public abstract class DataStore
|
public abstract class DataStore
|
||||||
{
|
{
|
||||||
|
private GriefPrevention instance;
|
||||||
|
|
||||||
//in-memory cache for player data
|
//in-memory cache for player data
|
||||||
protected ConcurrentHashMap<UUID, PlayerData> playerNameToPlayerDataMap = new ConcurrentHashMap<UUID, PlayerData>();
|
protected ConcurrentHashMap<UUID, PlayerData> playerNameToPlayerDataMap = new ConcurrentHashMap<UUID, PlayerData>();
|
||||||
|
|
||||||
|
|
@ -1682,8 +1685,11 @@ public abstract class DataStore
|
||||||
String param = args[i];
|
String param = args[i];
|
||||||
message = message.replace("{" + i + "}", param);
|
message = message.replace("{" + i + "}", param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeniedMessageEvent event = new DeniedMessageEvent(messageID, message);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
return message;
|
return event.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
//used in updating the data schema from 0 to 1.
|
//used in updating the data schema from 0 to 1.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package me.ryanhamshire.GriefPrevention.events;
|
||||||
|
|
||||||
|
import me.ryanhamshire.GriefPrevention.Messages;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when GP is retrieving the denial message to send to the player when canceling an action
|
||||||
|
*
|
||||||
|
* @author RoboMWM
|
||||||
|
* Created 1/4/2017.
|
||||||
|
*/
|
||||||
|
public class DeniedMessageEvent extends Event
|
||||||
|
{
|
||||||
|
// Custom Event Requirements
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public HandlerList getHandlers() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String message;
|
||||||
|
private Messages messageID;
|
||||||
|
|
||||||
|
public DeniedMessageEvent(Messages messageID, String message)
|
||||||
|
{
|
||||||
|
this.message = message;
|
||||||
|
this.messageID = messageID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Messages getMessageID()
|
||||||
|
{
|
||||||
|
return this.messageID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage()
|
||||||
|
{
|
||||||
|
return this.message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the message to print to the player.
|
||||||
|
* @param message Cannot be null. Set to an empty string if you wish for no message to be printed.
|
||||||
|
*/
|
||||||
|
public void setMessage(@Nonnull String message)
|
||||||
|
{
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user