本文整理汇总了Java中org.bukkit.plugin.java.JavaPlugin类的典型用法代码示例。如果您正苦于以下问题:Java JavaPlugin类的具体用法?Java JavaPlugin怎么用?Java JavaPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaPlugin类属于org.bukkit.plugin.java包,在下文中一共展示了JavaPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEnable
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public void onEnable() {
// Console sender
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "|----------|");
getServer().getConsoleSender().sendMessage(ChatColor.AQUA + "Starting Mortuus Terra chat.");
core = JavaPlugin.getPlugin(MortuusTerraCore.class);
frequencyManager = new FrequencyManager();
fileManager = new FileManager();
playerManager = new PlayerManager();
textMessageManager = new TextMessageManager();
messageScrambler = new MessageScrambler();
getFileManager().loadFiles();
registerCommands();
registerListeners();
// Console sender
getServer().getConsoleSender().sendMessage(ChatColor.AQUA + "Mortuus Terra chat ready.");
getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "|----------|");
}
示例2: SignsConfig
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public SignsConfig(JavaPlugin plugin) {
super(plugin, "signs");
for (String key : config.getKeys(false)) {
if (Utils.isInt(key)) {
Set<DonorSign> signs = new HashSet<>();
for (Location loc : stringsToLocArray(config.getStringList(key))) {
if (loc != null) {
Block block = loc.getWorld().getBlockAt(loc);
if (block.getState() instanceof Sign) {
signs.add(new DonorSign(Utils.getInt(key), block));
}
}
}
donorSigns.put(Utils.getInt(key), signs);
}
}
}
示例3: getLibraryResolver
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
@Override
public LibraryResolver getLibraryResolver(Object realm) {
if (!(realm instanceof JavaPlugin))
throw new IllegalArgumentException("Only realms of type " + JavaPlugin.class.getName() + " are supported");
JavaPlugin plugin = (JavaPlugin) realm;
ClassLoader classLoader = plugin.getClass().getClassLoader();
if (!(classLoader instanceof URLClassLoader))
throw new UnsupportedOperationException("Plugin " + plugin.getName() + " was not loaded by a URLClassLoader");
return libraryResolvers.computeIfAbsent(plugin.getName(), name -> new ClassLoaderLibraryResolver(
repositorySystem,
createSession(),
remoteRepositorySupplier,
(URLClassLoader) classLoader,
plugin.getLogger()
));
}
示例4: getInstance
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public JavaPlugin getInstance() {
if (plugin == null)
try {
throw new Exception();
} catch (Exception e) {
e.printStackTrace();
}
return plugin;
}
示例5: ConfigAPI
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public ConfigAPI(File file, JavaPlugin plugin) {
if (!file.exists()) {
try {
file.getParentFile().mkdirs();
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
this.config = YamlConfiguration.loadConfiguration(file);
}
示例6: Config
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
/**
* Creates new PluginFile, with defaults
* @param plugin - Your plugin
* @param fileName - Name of the file
* @param defaultsName - Name of the defaults
*/
public Config(JavaPlugin plugin, String fileName, String defaultsName) {
this.plugin = plugin;
this.defaults = defaultsName;
this.file = new File(plugin.getDataFolder(), fileName);
reload();
}
示例7: fatal
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public static void fatal(final String prefix, final String context, final JavaPlugin plugin) {
Bukkit.getScheduler().runTaskTimer(plugin, new Runnable(){
@Override
public void run(){
Bukkit.getLogger().severe(prefix + context);
}
}, 0L, TimeUnit.SECONDS.toMillis(30));
}
示例8: initAll
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
void initAll(JavaPlugin plugin) {
armorstandLocationsFile = new ArmorstandLocationsFile(plugin);
endercrystalLocationsFile = new EndercrystalLocationsFile(plugin);
playerLocationsFile = new PlayerLocationsFile(plugin);
itemLocationsFile = new ItemLocationsFile(plugin);
mobLocationsFile = new MobLocationsFile(plugin);
bigItemLocationsFile = new BigItemLocationsFile(plugin);
xpOrbLocationsFile = new XPOrbLocationsFile(plugin);
}
示例9: show
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public AdvancementAPI show(JavaPlugin plugin, Player... players) {
add();
grant(players);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
revoke(players);
remove();
}, 20L);
return this;
}
示例10: playParticleEffectForPipeline
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public static void playParticleEffectForPipeline(Location location, ParticleEffectMeta particleEffectMeta, PetBlock petBlock) {
if (ConfigPet.getInstance().areParticlesForOtherPlayersVisible()) {
for (final Player player : location.getWorld().getPlayers()) {
Bukkit.getServer().getScheduler().runTaskAsynchronously(JavaPlugin.getPlugin(PetBlocksPlugin.class), () -> ((ParticleEffectData) particleEffectMeta).applyTo(location, player));
}
} else {
Bukkit.getServer().getScheduler().runTaskAsynchronously(JavaPlugin.getPlugin(PetBlocksPlugin.class), () -> ((ParticleEffectData) particleEffectMeta).applyTo(location, (Player) petBlock.getPlayer()));
}
}
示例11: registerAll
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public static void registerAll() {
RegisterHelper.PREFIX = PetBlocksPlugin.PREFIX_CONSOLE;
RegisterHelper.register("WorldGuard", "com.sk89q.worldguard.protection.ApplicableRegionSet", '5');
RegisterHelper.register("WorldGuard", "com.sk89q.worldguard.protection.ApplicableRegionSet", '6');
if (RegisterHelper.register("ClearLag")) {
try {
new ClearLagListener((JavaPlugin) Bukkit.getPluginManager().getPlugin("PetBlocks"));
} catch (final Exception ex) {
Bukkit.getServer().getConsoleSender().sendMessage(PetBlocksPlugin.PREFIX_CONSOLE + ChatColor.DARK_RED + "Manual hook failed. No interacting with [ClearLag.]");
}
}
}
示例12: undoOperation
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
/**
* Undos an operation
*
* @param player player
*/
boolean undoOperation(Player player) {
if (!this.hasSelection(player))
return false;
if (!this.operations.containsKey(player))
this.operations.put(player, new Operation[this.maxUndoAmount]);
final Operation operation = this.operations.get(player)[0];
if (operation != null) {
if (operation.getType() == OperationType.MIRROR) {
this.getSelection(player).mirror();
} else if (operation.getType() == OperationType.FLIP) {
this.getSelection(player).flip();
} else if (operation.getType() == OperationType.UPSIDEDOWN) {
this.getSelection(player).upSideDown();
} else if (operation.getType() == OperationType.UNCOMBINE) {
this.getSelection(player).join();
} else if (operation.getType() == OperationType.COMBINE) {
this.getSelection(player).tearApart();
} else if (operation.getType() == OperationType.ROTATE) {
this.selections.get(player).unSecureRotate((Double) operation.getOperationData());
} else if (operation.getType() == OperationType.ANGLES) {
this.getSelection(player).setBlockAngle((EulerAngle) operation.getOperationData());
} else if (operation.getType() == OperationType.PLACE || operation.getType() == OperationType.CONVERTOBLOCKS) {
final List<Container> containers = (List<Container>) operation.getOperationData();
Bukkit.getServer().getScheduler().runTask(JavaPlugin.getPlugin(AstralEditPlugin.class), () -> this.placeUndoCalc(0, containers.get(0), containers, 0));
} else if (operation.getType() == OperationType.MOVE) {
this.selections.get(player).teleport((Location) operation.getOperationData());
}
this.removeOperation(player);
return true;
}
return false;
}
示例13: load
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
/**
* Loads and enables a plugin for mocking.
*
* @param class1 The plugin to load for mocking.
*/
@SuppressWarnings("unchecked")
public static <T extends JavaPlugin> T load(Class<T> plugin)
{
if (mock != null)
{
JavaPlugin instance = mock.getPluginManager().loadPlugin(plugin);
mock.getPluginManager().enablePlugin(instance);
return (T) instance;
}
else
{
throw new IllegalStateException("Not mocking");
}
}
示例14: registerAll
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public static void registerAll() {
try {
LightRegistry.RABBIT.register("com.github.shynixn.blockball.business.bukkit.nms.VERSION.CustomRabbit");
RegisterHelper.PREFIX = BlockBallPlugin.PREFIX_CONSOLE;
RegisterHelper.register("WorldGuard", "com.sk89q.worldguard.protection.ApplicableRegionSet", '5');
RegisterHelper.register("WorldGuard", "com.sk89q.worldguard.protection.ApplicableRegionSet", '6');
RegisterHelper.register("BossBarAPI");
RegisterHelper.register("Vault");
if (RegisterHelper.register("PlaceholderAPI")) {
PlaceHolderApiConnection.init((JavaPlugin) Bukkit.getPluginManager().getPlugin("BlockBall"));
}
} catch (final Error ex) {
Bukkit.getConsoleSender().sendMessage(BlockBallPlugin.PREFIX_CONSOLE + ChatColor.DARK_RED + "Failed to register the last dependency.");
}
}
示例15: GameController
import org.bukkit.plugin.java.JavaPlugin; //导入依赖的package包/类
public GameController() {
super(JavaPlugin.getPlugin(BlockBallPlugin.class));
this.arenaManager = ArenaController.createArenaController(this);
new EventCommandExecutor(this);
if (Config.getInstance().getGlobalJoinCommand().isEnabled())
new GlobalJoinCommandExecutor(this);
if (Config.getInstance().getGlobalLeaveCommand().isEnabled())
new GlobalLeaveCommandExecutor(this);
new GameListener(this);
this.run();
}