Microsoft Entity Framework

Итак, я смог получить функцию mutechat со следующим кодом: package com.ste999.events;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
//import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.Listener;
import org.bukkit.plugin.PluginManager;

public class Main extends JavaPlugin implements Listener{
    public static boolean chatMuted = false;
    @Override
    public void onEnable()
    {
        getLogger().info("events tester enabled!");
        PluginManager pm = this.getServer().getPluginManager();
        pm.registerEvents(this, (this));
    }

    @Override
    public void onDisable()
    {
        getLogger().info("events tester disabled!");
    }

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
    {
        Player player = (Player)sender;
        if (cmd.getName().equalsIgnoreCase("mutechat")) {
            if (player.hasPermission("ste999.chat.mute")) {
            if(chatMuted == false) {
                Bukkit.broadcastMessage("§aThe chat has been disabled!");
                chatMuted = true;
                }
                else {
                if(chatMuted == true) {
                Bukkit.broadcastMessage("§aThe chat has been enabled!");
                chatMuted = false;
                }
                }
            } else {
                if (!player.hasPermission("ste999.chat.mute")) {
                player.sendMessage("§4You can't mute the chat silly!");
                }
            }
            }
    return false;
    }
    @EventHandler
    public void OnChat(AsyncPlayerChatEvent event)
    {
        Player pli = event.getPlayer();
        if (chatMuted == true) {
            if (!pli.hasPermission("ste999.chat.bypass")) {
                event.setCancelled(true);
                pli.sendMessage("§4The chat has been disabled");
            } else {
                if (pli.hasPermission("ste999.chat.bypass")) {
                    event.setCancelled(false);
                }
            }
        }
    }
}

Мне нужно было зарегистрировать события, но getServer().getPluginManager().registerEvents(this, this) у меня не сработало, поэтому Мне нужно было сделать это так, как я это делал в коде в onEnable и там, где было несколько других проблем

.
6
задан Mihai Limbășan 26 April 2009 в 20:02
поделиться

2 ответа

The Entity Data Source appears on the Toolbox, in the Data section.

Here's some helpful information from an MSDN blog for people who can't see the item in the Toolbox:

Can't find the Entity Data Source?

If you upgrade the RTM version of Visual Studio 2008 with SP1, the EntityDataSource control doesn't appear in the Data group of the Web project Toolbox by default. To add the control to the Toolbox:

  • ·Open Visual Studio
  • ·Open or create a Web Application or Project.
  • ·Make sure the Toolbox tool window is visible.
  • ·Right click on the Toolbox, in the Data group and click on the "Choose Items…" option.
  • ·Wait for the "Choose Toolbox Items" window to appear.
  • ·Scroll down in the list of components under the ".NET Framework Components" tab until you find
    "EntityDataSource"
  • ·Ensure the checkbox is marked next to the EntityDataSource component and click on the OK button.

If you cannot see “EntityDataSource” in the list, you may need to add the assembly manually. To do that, click on the “Browse” button on the “Choose Toolbox Items” window. Then browse for the System.Web.Entity.dll under “C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5” or the equivalent folder in your configuration.

5
ответ дан 17 December 2019 в 04:52
поделиться
0
ответ дан 17 December 2019 в 04:52
поделиться
Другие вопросы по тегам:

Похожие вопросы: