mirror of
				https://github.com/GayPizzaSpecifications/foundation.git
				synced 2025-11-04 11:39:39 +00:00 
			
		
		
		
	Initial commit.
This commit is contained in:
		
							
								
								
									
										39
									
								
								src/main/java/cloud/kubelet/foundation/Foundation.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								src/main/java/cloud/kubelet/foundation/Foundation.java
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,39 @@
 | 
			
		||||
package cloud.kubelet.foundation;
 | 
			
		||||
 | 
			
		||||
import io.papermc.paper.event.player.ChatEvent;
 | 
			
		||||
import net.kyori.adventure.text.Component;
 | 
			
		||||
import org.bukkit.event.EventHandler;
 | 
			
		||||
import org.bukkit.event.Listener;
 | 
			
		||||
import org.bukkit.plugin.java.JavaPlugin;
 | 
			
		||||
 | 
			
		||||
public final class Foundation extends JavaPlugin implements Listener {
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public void onEnable() {
 | 
			
		||||
    getServer().getPluginManager().registerEvents(this, this);
 | 
			
		||||
 | 
			
		||||
    getDataFolder().mkdir();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public void onDisable() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private final Component leftBracket = Component.text('[');
 | 
			
		||||
  private final Component rightBracket = Component.text(']');
 | 
			
		||||
 | 
			
		||||
  @EventHandler
 | 
			
		||||
  private void onChatMessage(ChatEvent e) {
 | 
			
		||||
    e.setCancelled(true);
 | 
			
		||||
 | 
			
		||||
    final var name = e.getPlayer().displayName();
 | 
			
		||||
    final var component = Component.empty()
 | 
			
		||||
        .append(leftBracket)
 | 
			
		||||
        .append(name)
 | 
			
		||||
        .append(rightBracket)
 | 
			
		||||
        .append(Component.text(' '))
 | 
			
		||||
        .append(e.message());
 | 
			
		||||
 | 
			
		||||
    getServer().sendMessage(component);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								src/main/resources/plugin.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/main/resources/plugin.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
name: Foundation
 | 
			
		||||
version: '${version}'
 | 
			
		||||
main: cloud.kubelet.foundation.Foundation
 | 
			
		||||
api-version: 1.18
 | 
			
		||||
prefix: Foundation
 | 
			
		||||
load: STARTUP
 | 
			
		||||
authors:
 | 
			
		||||
  - kubelet
 | 
			
		||||
commands: {}
 | 
			
		||||
		Reference in New Issue
	
	Block a user