Register for your free account! | Forgot your password?

Go Back   elitepvpers > Other Online Games > Minecraft
You last visited: Today at 04:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Particle Effects

Discussion on Particle Effects within the Minecraft forum part of the Other Online Games category.

Reply
 
Old   #1
 
ຖēxiຊ's Avatar
 
elite*gold: 10
Join Date: Jun 2013
Posts: 639
Received Thanks: 53
Particle Effects

Heej liebes Forum,

ich brauch mal eure Hilfe.
Ich bin grade dabei ein Plugin zu schreiben was einem ermöglicht wenn er einen rechtsklick auf ein NetherStar macht öffnet sich ein Inventar.
In diesem Inventar sind Items und wenn man auf diese klickt bekommt man ein Particle Effect über sich gesetzt.
Dies klapp bis hierhin.
Aber wenn man das im Multiplayer nutzt ändert es den effect von jedem Spieler nicht nur von dem der draufgeklickt hat....

Code:
package me.tedwurd;

import me.tedwurd.MainClass;
import me.tedwurd.ParticleEffect;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;

public class InventoryListener implements Listener {

	private MainClass plugin;

	public InventoryListener(MainClass info) {
		this.plugin = info;
		this.plugin.getServer().getPluginManager().registerEvents(this, plugin);
	}

	@EventHandler
	public void onInvClick(InventoryClickEvent e) {
		Player p = (Player) e.getWhoClicked();

		if (e.getInventory().getName().equalsIgnoreCase("§6Particles")) {
			e.setCancelled(true);

			// - Herzen
			if (e.getCurrentItem().getType() == Material.APPLE) {
				p.closeInventory();
				p.playSound(p.getLocation(), Sound.CHEST_CLOSE, 1, 1);
				Bukkit.getScheduler().cancelAllTasks();

				
				Bukkit.getServer()
						.getScheduler()
						.scheduleSyncRepeatingTask(this.plugin = plugin,
								new Runnable() {
									public void run() {
										for (Player p : Bukkit.getServer()
												.getOnlinePlayers()) {
											ParticleEffect.HEART.display(
													p.getLocation()
															.add(0, 2, 0), 15,
													0, 0, 0, 10, 10);
										}
									}
								}, 0, 25);
			}

			// - Lava
			if (e.getCurrentItem().getType() == Material.LAVA_BUCKET) {
				p.closeInventory();
				p.playSound(p.getLocation(), Sound.CHEST_CLOSE, 1, 1);
				Bukkit.getScheduler().cancelAllTasks();

				Bukkit.getServer()
						.getScheduler()
						.scheduleSyncRepeatingTask(this.plugin = plugin,
								new Runnable() {
									public void run() {
										for (Player p : Bukkit.getServer()
												.getOnlinePlayers()) {
											ParticleEffect.LAVA.display(
													p.getLocation()
															.add(0, 2, 0), 15,
													0, 0, 0, 10, 10);
										}
									}
								}, 0, 50);
			}

			// - WitchMagic
			if (e.getCurrentItem().getType() == Material.EXP_BOTTLE) {
				p.closeInventory();
				p.playSound(p.getLocation(), Sound.CHEST_CLOSE, 1, 1);
				Bukkit.getScheduler().cancelAllTasks();

				Bukkit.getServer()
						.getScheduler()
						.scheduleSyncRepeatingTask(this.plugin = plugin,
								new Runnable() {
									public void run() {
										for (Player p : Bukkit.getServer()
												.getOnlinePlayers()) {
											ParticleEffect.WITCH_MAGIC.display(
													p.getLocation()
															.add(0, 2, 0), 15,
													0, 0, 0, 10, 10);
										}
									}
								}, 0, 1);
			}

		}

	}
}
Ich Danke euch jetzt schonmal
Liebe Grüße!
ຖēxiຊ is offline  
Old 07/28/2014, 21:19   #2


 
False's Avatar
 
elite*gold: 0
The Black Market: 243/0/0
Join Date: Apr 2011
Posts: 11,118
Received Thanks: 2,435
Entweder ich verstehe es falsch oder du zeigst uns die falsche klasse, hier werden ja nur die Items den Inventar hinzugefügt und es geöffnet.
Übrings frage ich mich warum dort 3mal p.openInventory(plugin.inv); hast wenn danach noch Items hinzugefügt werden?
False is offline  
Thanks
1 User
Old 07/28/2014, 21:24   #3
 
ຖēxiຊ's Avatar
 
elite*gold: 10
Join Date: Jun 2013
Posts: 639
Received Thanks: 53
Quote:
Originally Posted by .ƒaℓsє. View Post
Entweder ich verstehe es falsch oder du zeigst uns die falsche klasse, hier werden ja nur die Items den Inventar hinzugefügt und es geöffnet.
Übrings frage ich mich warum dort 3mal p.openInventory(plugin.inv); hast wenn danach noch Items hinzugefügt werden?

hups war falsche klasse
Ist oben

Hatte das immer kopiert und eingefügt nach dem Herz und vergessen es wegzunehmen^^
Danke für den hinweiß :P
ຖēxiຊ is offline  
Old 07/28/2014, 21:30   #4


 
False's Avatar
 
elite*gold: 0
The Black Market: 243/0/0
Join Date: Apr 2011
Posts: 11,118
Received Thanks: 2,435
Mit logischen denken bekommt man das eigentlich ganz leicht raus.
Frag dich was passiert wenn wenn du auf ein Item klickst -> es wird ein sheduler gestartet der die particle abspielt.
Klickst du ein weiteres Item an wird ein neuer sheduler gestartet, sprich nun sind zwei an die zwei verschiedene Particle abspielen.

Lösung:
Entweder die sheduler wieder beenden oder der ausgewählte particle speichern(ob config,hashmap, etc ist egal) und in EINEM sheduler auslesen und den passenden Particle erzeugen.
False is offline  
Thanks
1 User
Old 07/28/2014, 22:22   #5
 
ຖēxiຊ's Avatar
 
elite*gold: 10
Join Date: Jun 2013
Posts: 639
Received Thanks: 53
Danke dir klappt
ຖēxiຊ is offline  
Reply


Similar Threads Similar Threads
I need isro data.pk2 and particle.pk2
06/03/2016 - SRO Private Server - 5 Replies
can anyone give me the link for isro data.pk2 and particle.pk2??? coz my net too slow to download full isro client :(.
Remove Particle with CE, new offsets needed!!
09/26/2013 - Path of Exile - 0 Replies
any1 got new offsets to disable those particles, projectiles, impacts, effects etc... it worked before <CheatEntries> <CheatEntry> <ID>339</ID>
PoE Particle Control Tool
02/28/2013 - Path of Exile - 7 Replies
This tool can be used to increase, decrease, or remove the number of particles on screen. Many users have stated that it has increased their FPS, especially when in parties. Such uses could be to remove the Poison Arrow poison cloud which can quickly slow down a PC. This tool is not mine. I can not state the site it came from without violating EPvP TOS. However, credits to the creator: *Wrongusername The source CT file has been included.
NEW media.pk2+particle.pk2 (ecsro)
12/06/2009 - SRO PServer Guides & Releases - 15 Replies
new underbar new hp/mp nuke d10 new zerk... download: MEGAUPLOAD - The leading online storage and file delivery service http://www.imageshock.eu/img_small/3936645~SRO2009 -03-0407-46-5.jpg http://www.imageshock.eu/img_small/3937467~Sansti tre.jpg
Particle ausschalten
01/06/2009 - Kal Online - 9 Replies
Hey Leute, wisst ihr wie man die Particle aus Kalonline entfernt? Habe /set NoParticle versucht, aber dann schließt sich das Game... Darf von meinem Arzt keine Blitze sehen, wegen Epilepsie... Kann mir jemand helfen? VIELEN DANK :mofo:



All times are GMT +2. The time now is 04:41.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.