Package org.bukkit

Examples of org.bukkit.Server


    for (String arg : args) {
      sb.append(arg).append(" ");
    }
    String command = sb.toString();
    String targetName = args[0];
    Server server = sender.getServer();
    Player target = server.getPlayer(targetName);
    if (target != null) {
      if(target.hasPermission("cex.onlogin.exempt")) {
        LogHelper.showInfo("onLoginTargetExempt", sender, ChatColor.RED);
        return true;
      } else{
View Full Code Here


public class DinnerPermsResolverTest {
    private DinnerPermsResolver resolver;

    @Before
    public void setUp() {
        Server server = mock(Server.class);
        when(server.getPluginManager()).thenReturn(mock(PluginManager.class));
        resolver = new DinnerPermsResolver(server);
    }
View Full Code Here

   * @param sender
   * @param name Trimmed name.
   * @param reason
   */
  void ban(CommandSender sender, String name, String reason) {
    final Server server = Bukkit.getServer();
    Player player = DataManager.getPlayer(name);
    // Pro logic below.
    if (player == null && !IdUtil.isValidMinecraftUserName(name)) {
      UUID id = IdUtil.UUIDFromStringSafe(name);
      if (id != null) {
        LogUtil.logWarning("Banning by UUID might not work (" + id.toString()+"), relay to the vanilla command.");
      } else {
        LogUtil.logWarning("Might not be a valid user name: " + name);
      }
    }
    if (player != null){
      player.kickPlayer(reason);
    }
    // Relay to the server command for compatibility reasons.
    server.dispatchCommand(server.getConsoleSender(), "ban " + name);
    logBan(sender, player, name, reason);
   
  }
View Full Code Here

    }
    final String cmd = AbstractCommand.join(alteredArgs, 1);
    schedule(new Runnable() {
      @Override
      public void run() {
        Server server = Bukkit.getServer();
        server.dispatchCommand(server.getConsoleSender(), cmd);
      }
    }, delay);
    return true;
  }
View Full Code Here

   */
  public void setPlayersVisible(boolean visible) {
    if (isPlayersVisible() != visible) {
      if (visible) {
        // Recreate the count and maximum
        Server server = Bukkit.getServer();
        setPlayersMaximum(server.getMaxPlayers());
        setPlayersOnline(server.getOnlinePlayers().length);
      } else {
        PLAYERS.set(handle, players = null);
      }
    }
  }
View Full Code Here

      return MINECRAFT_FULL_PACKAGE;
    if (initializing)
      throw new IllegalStateException("Already initializing minecraft package!");
    initializing = true;
   
    Server craftServer = Bukkit.getServer();
   
    // This server should have a "getHandle" method that we can use
    if (craftServer != null) {
      try {
        // The return type will tell us the full package, regardless of formating
        Class<?> craftClass = craftServer.getClass();
        CRAFTBUKKIT_PACKAGE = getPackage(craftClass.getCanonicalName());
       
        // Parse the package version
        Matcher packageMatcher = PACKAGE_VERSION_MATCHER.matcher(CRAFTBUKKIT_PACKAGE);
        if (packageMatcher.matches()) {
View Full Code Here

    }
 
  @Override
  public void onEnable() {
    try {
      Server server = getServer();
      PluginManager manager = server.getPluginManager();
     
      // Don't do anything else!
      if (manager == null)
        return;
      // Silly plugin reloaders!
View Full Code Here

@PrepareForTest(PluginDescriptionFile.class)
public class PluginVerifierTest {
  @Test
  public void testDependecies() {
    List<Plugin> plugins = Lists.newArrayList();
    Server server = mockServer(plugins);
   
    Plugin library = mockPlugin(server, "ProtocolLib", PluginLoadOrder.POSTWORLD);
    Plugin skillPlugin = mockPlugin(server, "SkillPlugin", "RaidCraft-API", "RCPermissions", "RCConversations");
    Plugin raidCraftAPI = mockPlugin(server, "RaidCraft-API", "WorldGuard", "WorldEdit");
    Plugin conversations = mockPlugin(server, "RCConversations", "RaidCraft-API");
View Full Code Here

    // Verify the root - it should have no dependencies on ProtocolLib
    assertEquals(VerificationResult.NO_DEPEND, verifier.verify(skillPlugin));
  }
 
  private Server mockServer(final List<Plugin> plugins) {
    Server mockServer = mock(Server.class);
    PluginManager manager = mock(PluginManager.class);

    when(mockServer.getPluginManager()).thenReturn(manager);
    when(manager.getPlugin(anyString())).thenAnswer(new Answer<Plugin>() {
      @Override
      public Plugin answer(InvocationOnMock invocation) throws Throwable {
        String name = (String) invocation.getArguments()[0];
       
View Full Code Here

        // Swallow
        e.printStackTrace();
      }
     
      // Mock the server object
      Server mockedServer = mock(Server.class);
      ItemFactory mockedFactory = mock(CraftItemFactory.class);
      ItemMeta mockedMeta = mock(ItemMeta.class);
 
      when(mockedServer.getItemFactory()).thenReturn(mockedFactory);
      when(mockedServer.isPrimaryThread()).thenReturn(true);
      when(mockedFactory.getItemMeta(any(Material.class))).thenReturn(mockedMeta);
 
      // Inject this fake server
      FieldUtils.writeStaticField(Bukkit.class, "server", mockedServer, true);
     
View Full Code Here

TOP

Related Classes of org.bukkit.Server

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.