本文整理汇总了Java中cn.nukkit.utils.PluginException类的典型用法代码示例。如果您正苦于以下问题:Java PluginException类的具体用法?Java PluginException怎么用?Java PluginException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginException类属于cn.nukkit.utils包,在下文中一共展示了PluginException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addTask
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
private TaskHandler addTask(Plugin plugin, Runnable task, int delay, int period, boolean asynchronous) {
if (plugin != null && plugin.isDisabled()) {
throw new PluginException("Plugin '" + plugin.getName() + "' attempted to register a task while disabled.");
}
if (delay < 0 || period < 0) {
throw new PluginException("Attempted to register a task with negative delay or period.");
}
TaskHandler taskHandler = new TaskHandler(plugin, task, nextTaskId(), asynchronous);
taskHandler.setDelay(delay);
taskHandler.setPeriod(period);
taskHandler.setNextRunTick(taskHandler.isDelayed() ? currentTick + taskHandler.getDelay() : currentTick);
if (task instanceof Task) {
((Task) task).setHandler(taskHandler);
}
pending.offer(taskHandler);
taskMap.put(taskHandler.getTaskId(), taskHandler);
return taskHandler;
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:23,代码来源:ServerScheduler.java
示例2: addAttachment
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
@Override
public PermissionAttachment addAttachment(Plugin plugin, String name, Boolean value) {
if (plugin == null) {
throw new PluginException("Plugin cannot be null");
} else if (!plugin.isEnabled()) {
throw new PluginException("Plugin " + plugin.getDescription().getName() + " is disabled");
}
PermissionAttachment result = new PermissionAttachment(plugin, this.parent != null ? this.parent : this);
this.attachments.add(result);
if (name != null && value != null) {
result.setPermission(name, value);
}
this.recalculatePermissions();
return result;
}
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:18,代码来源:PermissibleBase.java
示例3: setMetadata
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
public void setMetadata(Object subject, String metadataKey, MetadataValue newMetadataValue) {
if (newMetadataValue == null) {
throw new ServerException("Value cannot be null");
}
Plugin owningPlugin = newMetadataValue.getOwningPlugin();
if (owningPlugin == null) {
throw new PluginException("Plugin cannot be null");
}
String key = this.disambiguate((Metadatable) subject, metadataKey);
Map<Plugin, MetadataValue> entry = this.metadataMap.get(key);
if (entry == null) {
entry = new WeakHashMap<>(1);
this.metadataMap.put(key, entry);
}
entry.put(owningPlugin, newMetadataValue);
}
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:17,代码来源:MetadataStore.java
示例4: addTask
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
private TaskHandler addTask(Plugin plugin, Runnable task, int delay, int period, boolean asynchronous) {
if (plugin != null && plugin.isDisabled()) {
throw new PluginException("Plugin '" + plugin.getName() + "' attempted to register a task while disabled.");
}
if (delay < 0 || period < 0) {
throw new PluginException("Attempted to register a task with negative delay or period.");
}
TaskHandler taskHandler = new TaskHandler(plugin, task, nextTaskId(), asynchronous);
taskHandler.setDelay(delay);
taskHandler.setPeriod(period);
taskHandler.setNextRunTick(taskHandler.isDelayed() ? currentTick + taskHandler.getDelay() : currentTick);
pending.offer(taskHandler);
taskMap.put(taskHandler.getTaskId(), taskHandler);
return taskHandler;
}
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:19,代码来源:ServerScheduler.java
示例5: PermissionAttachment
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
public PermissionAttachment(Plugin plugin, Permissible permissible) {
if (!plugin.isEnabled()) {
throw new PluginException("Plugin " + plugin.getDescription().getName() + " is disabled");
}
this.permissible = permissible;
this.plugin = plugin;
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:8,代码来源:PermissionAttachment.java
示例6: addAttachment
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
@Override
public PermissionAttachment addAttachment(Plugin plugin, String name, Boolean value) {
if (!plugin.isEnabled()) {
throw new PluginException("Plugin " + plugin.getDescription().getName() + " is disabled");
}
PermissionAttachment result = new PermissionAttachment(plugin, this.parent != null ? this.parent : this);
this.attachments.add(result);
if (name != null && value != null) {
result.setPermission(name, value);
}
this.recalculatePermissions();
return result;
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:16,代码来源:PermissibleBase.java
示例7: registerEvent
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
public void registerEvent(Class<? extends Event> event, Listener listener, EventPriority priority, EventExecutor executor, Plugin plugin, boolean ignoreCancelled) throws PluginException {
if (!plugin.isEnabled()) {
throw new PluginException("Plugin attempted to register " + event + " while not enabled");
}
try {
Timing timing = Timings.getPluginEventTiming(event, listener, executor, plugin);
this.getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled, timing));
} catch (IllegalAccessException e) {
Server.getInstance().getLogger().logException(e);
}
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:13,代码来源:PluginManager.java
示例8: setMetadata
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
public void setMetadata(Object subject, String metadataKey, MetadataValue newMetadataValue) {
if (newMetadataValue == null) {
throw new ServerException("Value cannot be null");
}
Plugin owningPlugin = newMetadataValue.getOwningPlugin();
if (owningPlugin == null) {
throw new PluginException("Plugin cannot be null");
}
String key = this.disambiguate((Metadatable) subject, metadataKey);
Map<Plugin, MetadataValue> entry = this.metadataMap.computeIfAbsent(key, k -> new WeakHashMap<>(1));
entry.put(owningPlugin, newMetadataValue);
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:13,代码来源:MetadataStore.java
示例9: removeMetadata
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
public void removeMetadata(Object subject, String metadataKey, Plugin owningPlugin) {
if (owningPlugin == null) {
throw new PluginException("Plugin cannot be null");
}
String key = this.disambiguate((Metadatable) subject, metadataKey);
Map entry = this.metadataMap.get(key);
if (entry == null) {
return;
}
entry.remove(owningPlugin);
if (entry.isEmpty()) {
this.metadataMap.remove(key);
}
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:15,代码来源:MetadataStore.java
示例10: invalidateAll
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
public void invalidateAll(Plugin owningPlugin) {
if (owningPlugin == null) {
throw new PluginException("Plugin cannot be null");
}
for (Map value : this.metadataMap.values()) {
if (value.containsKey(owningPlugin)) {
((MetadataValue) value.get(owningPlugin)).invalidate();
}
}
}
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:11,代码来源:MetadataStore.java
示例11: removeMetadata
import cn.nukkit.utils.PluginException; //导入依赖的package包/类
public void removeMetadata(Object subject, String metadataKey, Plugin owningPlugin) {
if (owningPlugin == null) {
throw new PluginException("Plugin cannot be null");
}
String key = this.disambiguate((Metadatable) subject, metadataKey);
Map entry = (Map) this.metadataMap.get(key);
if (entry == null) {
return;
}
entry.remove(owningPlugin);
if (entry.isEmpty()) {
this.metadataMap.remove(key);
}
}
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:15,代码来源:MetadataStore.java
注:本文中的cn.nukkit.utils.PluginException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论