本文整理汇总了Java中com.sk89q.worldguard.bukkit.WorldGuardPlugin.inst方法的典型用法代码示例。如果您正苦于以下问题:Java WorldGuardPlugin.inst方法的具体用法?Java WorldGuardPlugin.inst怎么用?Java WorldGuardPlugin.inst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldguard.bukkit.WorldGuardPlugin
的用法示例。
在下文中一共展示了WorldGuardPlugin.inst方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; //导入方法依赖的package包/类
@Override
public void run() {
if(wg == null){
wg = WorldGuardPlugin.inst();
}
if(rm == null ){
rm = wg.getRegionManager(Bukkit.getWorld(Bukkit.getServerName()));
}
System.out.println("Updating scores.");
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();
for(Player p : players){
if(p != null){
ApplicableRegionSet set = rm.getApplicableRegions(p.getLocation());
for(ProtectedRegion r : set){
if(r.getId().equalsIgnoreCase("OriginStation")){
p.sendMessage("Your score was not updated because you are in the spawn no-pvp zone.");
continue;
}
}
SQLDatabase.addScore(p.getUniqueId(), 1);
}
}
}
示例2: getPluginDepends
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; //导入方法依赖的package包/类
private boolean getPluginDepends() {
if (this.getServer().getPluginManager().getPlugin("WorldEdit") == null) {
this.getLogger().severe("Error: " + "WorldEdit not found!");
return false;
}
if (this.getServer().getPluginManager().getPlugin("WorldGuard") == null) {
this.getLogger().severe("Error: " + "WorldGuard not found!");
return false;
}
if (this.getServer().getPluginManager().getPlugin("Vault") == null) {
this.getLogger().severe("Error: " + "Vault not found!");
return false;
}
this.wgPl = WorldGuardPlugin.inst();
this.wePl = WorldEdit.getInstance();
return true;
}
示例3: registerWorldGuardFlag
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; //导入方法依赖的package包/类
private void registerWorldGuardFlag() {
if (getConfig().getBoolean("useWorldGuardFlags")) {
if (getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
getLogger().warning("Using world guards flags requires the plugin WorldGuard");
} else {
regionsWhitelist = new WorldGuardFlagSupport(WorldGuardPlugin.inst());
regionsWhitelist.registerWorldGuardFlag();
}
}
}
示例4: get
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; //导入方法依赖的package包/类
public static WorldGuardPlugin get() {
try {
Class.forName("com.sk89q.worldguard.bukkit.WorldGuardPlugin");
return WorldGuardPlugin.inst();
} catch (ClassNotFoundException e) {
return null;
}
}
示例5: onEnable
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void onEnable() {
saveDefaultConfig();
CodecRegistry codecRegistry = createCodecRegistry();
MongoClientSettings settings = MongoClientSettings.builder()
.clusterSettings(ClusterSettings.builder().applyConnectionString(new ConnectionString(getConfig().getString("mongodb.uri"))).build())
.codecRegistry(codecRegistry)
.build();
client = MongoClients.create(settings);
MongoDatabase database = client.getDatabase(getConfig().getString("mongodb.database"));
if (!testConnection(database))
return;
RegionStorageAdapter storageAdapter = new RegionStorageAdapter(database);
MongoRegionDriver driver = new MongoRegionDriver(getServer(), storageAdapter);
WorldGuardPlugin wgPlugin = WorldGuardPlugin.inst();
if (getConfig().getBoolean("mongodb.use_oplog")) {
getLogger().info("OpLog usage enabled.");
WorldGuardOpLogHandler opLogHandler = new WorldGuardOpLogHandler(codecRegistry.get(ProcessingProtectedRegion.class), storageAdapter, wgPlugin);
getServer().getScheduler().runTaskAsynchronously(this, new OpLogRetriever(
OpLogUtils.getCollection(client),
new OpLogParser(opLogHandler),
getConfig().getString("mongodb.database") + "." + RegionStorageAdapter.COLLECTION_NAME
));
storageAdapter.setListener(opLogHandler);
}
ConfigurationManager config = wgPlugin.getGlobalStateManager();
RegionContainer container = wgPlugin.getRegionContainer();
InjectionUtils.injectRegionDriver(container, driver);
InjectionUtils.callUnload(container);
InjectionUtils.callLoadWorlds(container);
config.selectedRegionStoreDriver = driver;
}
示例6: onEnable
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; //导入方法依赖的package包/类
public void onEnable(){
saveDefaultConfig();
wg = WorldGuardPlugin.inst();
rm = wg.getRegionManager(Bukkit.getWorld(Bukkit.getServerName()));
for(String key : getConfig().getKeys(false)){
Port p = new Port(getConfig(), key, rm);
if(p.region != null){
ports.add(p);
System.out.println("port added: " + p.name);
}
}
PortTask t = new PortTask();
int delay = PortTask.getIntervalShipLeavesEvery(20 * 60);
t.runTaskTimer(this, delay, delay);
}
示例7: onCommand
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; //导入方法依赖的package包/类
public void onCommand(MCPlayerCommandEvent event) {
WorldGuardPlayerListener wgpl = new WorldGuardPlayerListener(WorldGuardPlugin.inst());
wgpl.onPlayerCommandPreprocess((PlayerCommandPreprocessEvent) event._GetObject());
}
示例8: WorldGuardListener
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; //导入方法依赖的package包/类
public WorldGuardListener() {
worldGuardPlugin = WorldGuardPlugin.inst();
SimpleTownsXtras.log("WorldGuard features enabled.");
}